-
Notifications
You must be signed in to change notification settings - Fork 189
Open
Description
<?php
namespace App\Filament\Resources\LawPostResource\Pages;
use App\Filament\Resources\LawPostResource;
use Filament\Actions;
use Filament\Resources\Pages\EditRecord;
use Berkayk\OneSignal\OneSignalFacade as OneSignal;
// use OneSignal;
class EditLawPost extends EditRecord
{
protected static string $resource = LawPostResource::class;
protected function afterSave(): void
{
$post = $this->record;
$tags = explode(',', $post->tags);
$imageUrl = asset('images/law/' . $post->slug . '.jpg');
OneSignal::sendNotificationToAll(
"{$post->title} [Updated]",
$url = route('law.show', $post->slug),
$data = [
'post_id' => $post->id,
'author' => $post->author->name, // Assuming the author relationship exists
'big_picture' => $imageUrl, // Assuming image URL is stored in the post model
],
null, // Add user IDs or filters if needed
$tags,
);
}
protected function getHeaderActions(): array
{
return [
Actions\ViewAction::make(),
Actions\DeleteAction::make(),
Actions\ForceDeleteAction::make(),
Actions\RestoreAction::make(),
];
}
}
O-Nicks
Metadata
Metadata
Assignees
Labels
No labels