F
Filamentβ€’8mo ago
Quin.

Notification action not working becuase $table must before initialization

public static function toFilamentNotification(): FilamentNotification
{
return FilamentNotification::make()
->constructUsing(function (array $data) {
[
'user_id' => $userId,
'domain_check_id' => $domainCheckId,
'message' => $message,
'categories' => $categories
] = $data;
return new static(
user: User::find($userId),
domainCheck: DomainCheck::find($domainCheckId),
message: $message,
categories: $categories,
);
})->message(fn(self $notification) => $notification->message)
->description(fn(self $notification) => $notification->categories)
->actions([
Action::make('edit')
->url(fn (DomainCheck $record): string => route('DomainCheckResource.edit', $record))
->openUrlInNewTab()

]);
}
public static function toFilamentNotification(): FilamentNotification
{
return FilamentNotification::make()
->constructUsing(function (array $data) {
[
'user_id' => $userId,
'domain_check_id' => $domainCheckId,
'message' => $message,
'categories' => $categories
] = $data;
return new static(
user: User::find($userId),
domainCheck: DomainCheck::find($domainCheckId),
message: $message,
categories: $categories,
);
})->message(fn(self $notification) => $notification->message)
->description(fn(self $notification) => $notification->categories)
->actions([
Action::make('edit')
->url(fn (DomainCheck $record): string => route('DomainCheckResource.edit', $record))
->openUrlInNewTab()

]);
}
Typed property Filament\Tables\Actions\Action::$table must not be accessed before initialization
Typed property Filament\Tables\Actions\Action::$table must not be accessed before initialization
it's because the url has a function, but i couldn't find a solution for the error,. Anyone has a idea?
3 Replies
toeknee
toekneeβ€’8mo ago
I have a feeling you are using Tables\Action opposed to Notifications\Actions\Action;
Quin.
Quin.β€’8mo ago
Thank you will look into as soon as i am on my desktop again. But thank you for your replie πŸ˜„ Will let you know if that was it!