I am new in Laravel.
I used way generator to create laravel controller view and model, and it has default values for each item, But when I am going to see that with browser it is not working and showing an Error.
controller (PostsController.php):
class PostsController extends \BaseController {
public function index()
{
$posts = Post::all();
return View::make('posts.index', compact('posts'));
}
}
View (posts/index.blade.php):
This is index view
model (post.php)
class Post extends \Eloquent {
// Add your validation rules here
public static $rules = [
// 'title' => 'required'
];
protected $primarykey='user_id';
// Don't forget to fill this array
protected $fillable = [];
}
and this is route:
Route::resource('posts','postsController',array('except'=>array('show')));
when I type localhost:8000/posts/index, Laravel return an error:
Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException
What is the problem?