mushood
4390
18
Vue

Vue and laravel named routes

Posted 1 year ago by mushood

Hello

I am working on a vue project where I have a form:

Form:

<form method="POST" action:"/blog" @submit.prevent="submitForm">
.
.
.
.
</form>

The form is in a .vue file . Now I would like to change the action attribute to a named route in laravel. Here is my web.php route:

Route::post('/blog', '[email protected]')->name('blog.store');

However if I try this:

<form method="POST" action:"{{route('blog.store')}}" @submit.prevent="submitForm">
.
.
.
</form>

I get this error: Property or method "route" is not defined on the instance but referenced during render.

Which is understandable.

So my question remains, how to use named routes from laravel in vue

Please sign in or create an account to participate in this conversation.