Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

hamzajamshed152's avatar

Route [pagedetails.update] not defined.

I have a form from where i update post content but its not working because here is a error of route not defined Here is my Route

Route::post('pagedetails/update',[PageController::class,'UpdatePage']);

Here is my Blade Template Form

<form role="form" action="{{ route('pagedetails.update') }}" method="POST" enctype="multipart/form-data">
         				        @csrf
        <div class="card-body">
            <div class="form-group">
                <label for="full_name">Full Name</label>
                <input type="text" value="{{ $page->title }}" name="page_title" class="form-control" id="page_title" placeholder="Enter Your Full Name">
            </div>

            <div class="form-group">
                <label for="exampleInputEmail1">Page content</label>
                <textarea class="form-control validate[required] textarea-editor" name="description" id="description" placeholder="Content" rows="10" spellcheck="false">{{ $page->content }}</textarea>
            </div>
        </div>
        <div class="card-footer">
        <button type="submit" class="btn btn-primary">Update</button>
        </div>
</form>

I have Post List Page where I can edit it through getting slug

Route::get('pagedetails/{slug}',[PageController::class,'DetailPage']);
0 likes
5 replies
tykus's avatar
tykus
Best Answer
Level 104

Name your route(s) with the name method which will solve

Route [pagedetails.update] not defined.

Route::post('pagedetails/update',[PageController::class,'UpdatePage'])->name('pagedetails.update');

How does the UpdatePage controller action know which record to modify?

hamzajamshed152's avatar

@tykus thanks now it gets the route ........... and for record I am thinking how I can modify this can you help me in this how can I pass it through update route?

tykus's avatar

@hamzajamshed152 well, if you have a Page instance in the view; then you can pass that to the route helper:

<form role="form"
      action="{{ route('pagedetails.update', $page) }}"
      method="POST"
      enctype="multipart/form-data"
>

But then the Route should be modified to accept the Page's id:

Route::post('pagedetails/{page}/update',[PageController::class,'UpdatePage'])
    ->name('pagedetails.update');

And the Controller action should accept the parameter:

public function UpdatePage($page)
{
	// query for the Page using the $page variable
}

Please or to participate in this conversation.