Reputation: 9548
I have delcared my resource in routes.php:
Route::resource('user', 'UserController');
Now I want to use the link to my html-form:
<form action="{{ URL::route('user') }}" method="post">
<input type="text" name="username" placeholder="username" /><br />
<input type="text" name="password" placeholder="password" /><br />
<input type="text" name="uuid" placeholder="uuid" /><br /><br />
<input name="_type" type="hidden" value="login" />
<input type="submit" value="submit" />
</form>
But Laravel is throwing an exception:
production.ERROR: exception 'InvalidArgumentException' with message 'Route [user] not defined.
Upvotes: 0
Views: 364
Reputation: 1223
Your using wrong route name, use the following
<form action="{{ URL::route('user.store') }}" method="post">
Upvotes: 1
Reputation: 1494
When you use resources, the name of the route depends on the HTTP method. You can check the names by doing:
php artisan route:list
You have two options. Use the name you get there or just another helper function (which will be easier i think):
URL::action('UserController@store')
Upvotes: 0