ldc-legaulois/app/Models/OCBContent.php

37 lines
726 B
PHP
Raw Normal View History

<?php
namespace App\Models;
use App\Enums\OCBType;
use Illuminate\Database\Eloquent\Model;
use Kwaadpepper\Enum\Traits\CastsEnums;
2021-04-08 15:20:48 +02:00
class OCBContent extends Model
{
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);
});
}
}