X7ROOT File Manager
Current Path:
/home/gfecatvj/sites/realesbar/platform/plugins/blog/src/Models
home
/
gfecatvj
/
sites
/
realesbar
/
platform
/
plugins
/
blog
/
src
/
Models
/
📁
..
📄
Category.php
(1.84 KB)
📄
Post.php
(2.32 KB)
📄
Tag.php
(1.21 KB)
Editing: Tag.php
<?php namespace Botble\Blog\Models; use Botble\Base\Traits\EnumCastable; use Botble\Base\Enums\BaseStatusEnum; use Botble\Slug\Traits\SlugTrait; use Botble\Base\Models\BaseModel; use Illuminate\Database\Eloquent\Relations\BelongsToMany; class Tag extends BaseModel { use SlugTrait; use EnumCastable; /** * The database table used by the model. * * @var string */ protected $table = 'tags'; /** * The date fields for the model.clear * * @var array */ protected $dates = [ 'created_at', 'updated_at', ]; /** * The attributes that are mass assignable. * * @var array */ protected $fillable = [ 'name', 'description', 'status', 'author_id', ]; /** * @var array */ protected $casts = [ 'status' => BaseStatusEnum::class, ]; /** * @return BelongsToMany */ public function posts(): BelongsToMany { return $this->belongsToMany(Post::class, 'post_tags'); } protected static function boot() { parent::boot(); self::deleting(function (Tag $tag) { $tag->posts()->detach(); }); } }
Upload File
Create Folder