//HospitalResource::table()
return $table
->actions([
Tables\Actions\Action::make('create-content')
->label('Create Content')
->icon('heroicon-o-plus-circle')
->url(fn(Hospital $record) => route(CreateContent::getRouteName())),
]);
//CreateContent page
class CreateContent extends Page implements HasForms
{
use InteractsWithForms;
protected static string $view = 'filament.pages.create-content';
protected static ?string $slug = 'create-content';
public ?array $data = [];
public Hospital|Unit|Treatment $contentable;
public function mount(Hospital|Unit|Treatment $contentable): void
{
$this->contentable = $contentable;
$this->form->fill();
}
//HospitalResource::table()
return $table
->actions([
Tables\Actions\Action::make('create-content')
->label('Create Content')
->icon('heroicon-o-plus-circle')
->url(fn(Hospital $record) => route(CreateContent::getRouteName())),
]);
//CreateContent page
class CreateContent extends Page implements HasForms
{
use InteractsWithForms;
protected static string $view = 'filament.pages.create-content';
protected static ?string $slug = 'create-content';
public ?array $data = [];
public Hospital|Unit|Treatment $contentable;
public function mount(Hospital|Unit|Treatment $contentable): void
{
$this->contentable = $contentable;
$this->form->fill();
}