Default Resource Index instead of Dashboard for Panel?

Is it possible to set the an index of a resource to the default index of a panel versus setting a custom page/dashboard? Im probably just missing something simple here.
6 Replies
toeknee
toeknee2w ago
What about after login redirect to the resource?
Mark Chaney
Mark ChaneyOP2w ago
@toeknee seems more like a hack. Could definitely be done though.
Lara Zeus
Lara Zeus2w ago
this could be done, but need test 🙂 set the slug in the ListUsers
protected static ?string $slug = '/';
protected static ?string $slug = '/';
and disable the pages in the panel provider and add your class:
->pages([
//Pages\Dashboard::class,
UserResource\Pages\ListUsers::class
])
->pages([
//Pages\Dashboard::class,
UserResource\Pages\ListUsers::class
])
LeandroFerreira
create a CustomLoginResponse
class CustomLoginResponse extends LoginResponse
{
public function toResponse($request): RedirectResponse|Redirector
{
return redirect()->intended(YourResource::getUrl());
}
}
class CustomLoginResponse extends LoginResponse
{
public function toResponse($request): RedirectResponse|Redirector
{
return redirect()->intended(YourResource::getUrl());
}
}
In your panel:
return $panel
...
->bootUsing(function (): void {
app()->bind(LoginResponse::class, CustomLoginResponse::class);
})
return $panel
...
->bootUsing(function (): void {
app()->bind(LoginResponse::class, CustomLoginResponse::class);
})
Mark Chaney
Mark ChaneyOP2w ago
thanks guys for the ideas, will try those out
toeknee
toeknee7d ago
The Login response makes more sense to me and that was my suggestion. If you use the slug I feel you could end up with a conflict if you still want the dashboard? What I ended up doing was setting the order of the resource you want to be the home page to -10000000 or similar so it becomes first

Did you find this page helpful?