PagePlus/Entities/PagePlusMeta.php
ShadowVirtual e003ffa38a Page Plus
Changed the text editor
2024-04-01 03:51:52 -08:00

29 lines
734 B
PHP

<?php
namespace Modules\PagePlus\Entities;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Support\Facades\Cache;
class PagePlusMeta extends Model
{
protected $fillable = ['page_id', 'key', 'value'];
public function page(): BelongsTo
{
return $this->belongsTo(PagePlus::class, 'page_id');
}
protected static function booted(): void
{
static::saved(function ($meta) {
Cache::forget(PageHelper::cacheKey('meta', $meta->page_id) . '_' . $meta->key);
});
static::deleted(function ($meta) {
Cache::forget(PageHelper::cacheKey('meta', $meta->page_id) . '_' . $meta->key);
});
}
}