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

seedphrase's avatar

How to get ResourceId parameter required for the route

Hello, I want to use nova route in my vue, but I can't get the resourceId.

For this route there are tow parameters resourceName and resourceId. I could get resourceName, but not resourceId.

:href="route('nova.pages.edit', [$page.props.resourceName, $page.props.resourceId])"


Route::get('/dashboard', function (NovaRequest $request) {
    return Inertia::render('Dashboard', ['resourceName' => User::uriKey(), 'resourceId' => $request->route('resourceId') ]);
})->middleware(['auth', 'verified'])->name('dashboard');

0 likes
11 replies
MohamedTammam's avatar

use

$request->input('resourceId')

OR they are in the URL like /sourceName/sourceId?

seedphrase's avatar

@MohamedTammam Yes it is the route where I have to pass data for the frontend dashboard.vue to get acces to this route Route::get('/{resource}/{resourceId}', ResourceShowController::class);

MohamedTammam's avatar

@0mar It isn't how it works.

You only the what is in the route parameters, your /dashboard has no parameters so you get nothing.

PLUS

You should get them using defineProps in Vue not $page.prop

$page.props is for shared data.

seedphrase's avatar

@MohamedTammam In dashboard.vue, I have a link to nova.pages.edit (Route::get('/{resource}/{resourceId}', ResourceShowController::class), so I need two parameters for this route.

It worked for the resourceName

How get them using defineProps please?

seedphrase's avatar

@MohamedTammam

Here I am using the route, in dashboard.vue

   <DropdownLink :href="route('nova.pages.edit', ['resourceId', 'resourceName'])">
          Company 
  </DropdownLink>

How it worked for reousrceName:

pass data here

`Route::get('/dashboard', function () {
    return Inertia::render('Dashboard' ['resourceName', =>User::uriKey()]);
})->middleware(['auth', 'verified'])->name('dashboard');

And then in dashboard vue, I pass the data like this:

  <DropdownLink :href="route('nova.pages.index', $page.props.resourceName)">
       Company
  </DropdownLink>

Please or to participate in this conversation.