2020-09-28 15:41:21 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
2021-02-02 10:26:36 +01:00
|
|
|
use App\Enums\OCBType;
|
2020-09-28 15:41:21 +02:00
|
|
|
use Illuminate\Database\Eloquent\Model;
|
2021-03-02 14:58:59 +01:00
|
|
|
use Kwaadpepper\Enum\Traits\CastsEnums;
|
2020-09-28 15:41:21 +02:00
|
|
|
|
2021-04-08 15:20:48 +02:00
|
|
|
class OCBContent extends Model
|
2020-09-28 15:41:21 +02:00
|
|
|
{
|
2021-02-02 10:26:36 +01:00
|
|
|
use CastsEnums;
|
|
|
|
|
|
|
|
|
|
protected $enumCasts = [
|
|
|
|
|
'type' => OCBType::class
|
|
|
|
|
];
|
|
|
|
|
|
2021-04-08 15:20:48 +02:00
|
|
|
protected $table = 'ocb_content';
|
2021-04-26 15:44:00 +02:00
|
|
|
|
|
|
|
|
protected $fillable = [
|
|
|
|
|
'picture',
|
|
|
|
|
'content',
|
|
|
|
|
'type',
|
|
|
|
|
'order',
|
|
|
|
|
'status'
|
|
|
|
|
];
|
2021-05-05 15:13:33 +02:00
|
|
|
|
|
|
|
|
protected static function booted()
|
|
|
|
|
{
|
|
|
|
|
static::creating(function ($ocbContent) {
|
|
|
|
|
$ocbContent->content = clean($ocbContent->content);
|
|
|
|
|
});
|
|
|
|
|
static::updating(function ($ocbContent) {
|
|
|
|
|
$ocbContent->content = clean($ocbContent->content);
|
|
|
|
|
});
|
|
|
|
|
}
|
2020-09-28 15:41:21 +02:00
|
|
|
}
|