F
Filament16mo ago
Ehsan

Help with custom resource page

I have created a custom resource page and added its entry in getPages() method like this: 'print' => Pages\PrintCouponBatch::route('/print/{record}') I want the view for this page to use a custom layout. Also I am not able to access the $record in the view. {{ $record }} shows variable undefined whileas the doc says, the route param should be available in view. Any help with this will be appreciated.
4 Replies
Ehsan
EhsanOP16mo ago
I was able to access the record using mount() method on PrintCouponBatch class by doing
public function mount(CouponBatch $record): void
{
$this->couponBatch = $record;
}
public function mount(CouponBatch $record): void
{
$this->couponBatch = $record;
}
Now I want a custom blank layout for the page and not default admin panel container.
Saade
Saade16mo ago
change your page $layout from “layouts.app” to “layouts.base”
Ehsan
EhsanOP16mo ago
But there is no layouts.base defined. Or is it? Will have to create a new one.
Saade
Saade16mo ago
Source dive in the Page class, go to the parent BasePage class, and copy the $layout attribute to your page class, and make the change
Want results from more Discord servers?
Add your server