68 lines
1.2 KiB
PHP
68 lines
1.2 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Observers;
|
||
|
|
|
||
|
|
use Illuminate\Support\Facades\Cache;
|
||
|
|
use App\Models\Moment;
|
||
|
|
|
||
|
|
class MomentObserver
|
||
|
|
{
|
||
|
|
/**
|
||
|
|
* Handle the moment "created" event.
|
||
|
|
*
|
||
|
|
* @param \App\Moment $moment
|
||
|
|
* @return void
|
||
|
|
*/
|
||
|
|
public function created(Moment $moment)
|
||
|
|
{
|
||
|
|
//
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Handle the moment "updated" event.
|
||
|
|
*
|
||
|
|
* @param \App\Moment $moment
|
||
|
|
* @return void
|
||
|
|
*/
|
||
|
|
public function updated(Moment $moment)
|
||
|
|
{
|
||
|
|
$rd_moment_key = Moment::cacheMoemntKey($moment->id);
|
||
|
|
if (Cache::has($rd_moment_key)) {
|
||
|
|
Cache::forget($rd_moment_key);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Handle the moment "deleted" event.
|
||
|
|
*
|
||
|
|
* @param \App\Moment $moment
|
||
|
|
* @return void
|
||
|
|
*/
|
||
|
|
public function deleted(Moment $moment)
|
||
|
|
{
|
||
|
|
//
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Handle the moment "restored" event.
|
||
|
|
*
|
||
|
|
* @param \App\Moment $moment
|
||
|
|
* @return void
|
||
|
|
*/
|
||
|
|
public function restored(Moment $moment)
|
||
|
|
{
|
||
|
|
//
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Handle the moment "force deleted" event.
|
||
|
|
*
|
||
|
|
* @param \App\Moment $moment
|
||
|
|
* @return void
|
||
|
|
*/
|
||
|
|
public function forceDeleted(Moment $moment)
|
||
|
|
{
|
||
|
|
//
|
||
|
|
}
|
||
|
|
}
|