51 lines
1,011 B
PHP
51 lines
1,011 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Observers;
|
||
|
|
|
||
|
|
use App\Jobs\ProcessEntryUpdate;
|
||
|
|
use App\Models\Entry;
|
||
|
|
use Illuminate\Support\Facades\Log;
|
||
|
|
|
||
|
|
class EntryObserver
|
||
|
|
{
|
||
|
|
/**
|
||
|
|
* Handle the Entry "created" event.
|
||
|
|
*/
|
||
|
|
public function created(Entry $entry): void
|
||
|
|
{
|
||
|
|
ProcessEntryUpdate::dispatch($entry->id, 'created');
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Handle the Entry "updated" event.
|
||
|
|
*/
|
||
|
|
public function updated(Entry $entry): void
|
||
|
|
{
|
||
|
|
ProcessEntryUpdate::dispatch($entry->id, 'updated');
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Handle the Entry "deleted" event.
|
||
|
|
*/
|
||
|
|
public function deleted(Entry $entry): void
|
||
|
|
{
|
||
|
|
ProcessEntryUpdate::dispatch($entry->id, 'deleted');
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Handle the Entry "restored" event.
|
||
|
|
*/
|
||
|
|
public function restored(Entry $entry): void
|
||
|
|
{
|
||
|
|
//
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Handle the Entry "force deleted" event.
|
||
|
|
*/
|
||
|
|
public function forceDeleted(Entry $entry): void
|
||
|
|
{
|
||
|
|
// ProcessEntryUpdate::dispatch($entry, 'force deleted');
|
||
|
|
}
|
||
|
|
}
|