56 lines
1.2 KiB
PHP
56 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Contracts\TranslatableModel;
|
|
use App\Traits\Models\HasCache;
|
|
use App\Traits\Models\HasTranslations;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
use Uwil\LaravelActivityLogs\Traits\ActivityLog;
|
|
|
|
class DocumentCategory extends Model implements TranslatableModel
|
|
{
|
|
use ActivityLog;
|
|
use HasFactory;
|
|
use HasCache;
|
|
use HasTranslations;
|
|
use SoftDeletes;
|
|
|
|
/**
|
|
* The attributes that are mass assignable.
|
|
*
|
|
* @var list<string>
|
|
*/
|
|
protected $fillable = [
|
|
'name',
|
|
'slug'
|
|
];
|
|
|
|
/**
|
|
* The translatable columns.
|
|
*
|
|
* @var list<string>
|
|
*/
|
|
public $translatable = [
|
|
'name',
|
|
'slug'
|
|
];
|
|
|
|
/**
|
|
* Relation to Document
|
|
*
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
|
*/
|
|
public function documents(): \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
|
{
|
|
return $this->morphToMany(
|
|
Document::class,
|
|
'documentable',
|
|
'documentables',
|
|
'documentable_id',
|
|
'document_id'
|
|
);
|
|
}
|
|
}
|