I’m learning Laravel, practicing doing a project where I load documents (a crud).
I got to the point of doing the process of updating a document. When I click on the button I get the message THIS ACTION IS NOT AUTHORIZED, but I don’t have any permissions policy activated or created. I don’t know what this is due to.
Routes
Route::get('/document/{document}/edit', [DocumentController::class, 'edit'])->name('document.edit');
Route::put('/document/{document}/edit', [DocumentController::class, 'update'])->name('document.update');
In the first route I show the form and in the second one I make the logic to update it.
public function edit(Document $document)
{
return view('document.form-document-edit', [
'document' => $document,
'users' => User::all()
]);
}
public function update(UpdateDocumentRequest $request, Document $document)
{
return "update method is called";
I put the return in the update method to know if it would show me this message but it never shows me the return. I really don’t know what to do anymore, because I’m not getting anywhere.
I would love a little help in understanding the reasoning behind this.