I am learning laravel. Right now working on a project with inertia. Have created a model, controller and view in default settings.
I am able to create user with the built-in user manager.
But getting 403 error while creating records for my custom models.
Can anyone help me as to what could be causing this?
store method on user-creation works. But store method on my custom model throws 403.
2
Answers
Answering my own question.
Issue was with
authorize
method ofrequests
. That check was returningfalse
.As I am using
middleware
for validation.More info for future readers.
What is the purpose of the authorize method in a Request class in Laravel?
just need to add
@csrf
inside your form in the view, you can read more about it here