0

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.

2 Answers 2

1

Your using wrong route name, use the following

<form action="{{ URL::route('user.store') }}" method="post">
Sign up to request clarification or add additional context in comments.

Comments

0

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')

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.