Reputation: 109
// routes.php
Route::resource('/image', 'ImageController');
Route::get('/create', 'ImageController@create');
Route::post('/store', 'ImageController@store');
// create.blade.php
{!! Form::open(array('url' => '/store', 'method'=>'POST')) !!}
.......
{!! Form::close() !!}
Here if i don't write these two lines (Route::get('/create', 'ImageController@create'); Route::post('/store', 'ImageController@store');) The resource routing of create and store does not work and show some errors. Why this happens? Thanks in advance.
Upvotes: 0
Views: 881
Reputation: 10330
When creating resource route you don't have to create individual routes. Because all RESTfull default routes will be created for you automatically.
You just need following route
Route::resource('image', 'ImageController');
then change form
as below
{!! Form::open(array('route' => array('image.store'))) !!}
.......
{!! Form::close() !!}
Upvotes: 3