community!
I was learning laravel framework and got stuck at resource controller concept
I made a resource controller with the help of artisan command i.e php artisan make:controller PostController --resource
Here’s the code: create.blade.php(which is views/posts folder)
@extends('main')
@section('content')
<div class="row">
<div class="col-mid-8 col-md-offset-2" >
<h1>Create New Post</h1>
<hr>
<form action="posts/create" method="GET">
<div class="form-group">
<input type="text" class="form-control"
name="title" aria-describedby="emailHelp">
</div>
<div class="form-group">
<input type="text" class="form-control"
name="body" aria-describedby="emailHelp">
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
</div>
</div>
@endsection
PostController.php
class PostController extends Controller
{
public function create()
{
return view('posts.create');
}
web.php (route)
<?php
use Illuminate\Support\Facades\Route;
Route::resource('posts', 'PostController');
please, guide me what wrong I am doing.
Route::resource('posts', 'PostController@create');- DevSavatacreate()toindex()in PostController.php - DevSavata