56 lines
1.1 KiB
PHP
56 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Enums\OCBType;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Kwaadpepper\Enum\Traits\CastsEnums;
|
|
|
|
class OCBContent extends Model
|
|
{
|
|
use CastsEnums;
|
|
|
|
/**
|
|
* The attributes that should be cast to Enums.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $enumCasts = [
|
|
'type' => OCBType::class
|
|
];
|
|
|
|
/**
|
|
* The table associated with the model.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $table = 'ocb_content';
|
|
|
|
/**
|
|
* The attributes that are mass assignable.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $fillable = [
|
|
'picture',
|
|
'content',
|
|
'type',
|
|
'order',
|
|
'status'
|
|
];
|
|
|
|
/**
|
|
* Perform any actions required after the model boots.
|
|
*
|
|
* @return void
|
|
*/
|
|
protected static function booted()
|
|
{
|
|
static::creating(function ($ocbContent) {
|
|
$ocbContent->content = clean($ocbContent->content);
|
|
});
|
|
static::updating(function ($ocbContent) {
|
|
$ocbContent->content = clean($ocbContent->content);
|
|
});
|
|
}
|
|
}
|