63 lines
1,020 B
PHP
63 lines
1,020 B
PHP
<?php
|
|
|
|
/**
|
|
* Created by Reliese Model.
|
|
*/
|
|
|
|
namespace App\Models;
|
|
|
|
use Carbon\Carbon;
|
|
use Illuminate\Database\Eloquent\Collection;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Cviebrock\EloquentSluggable\Sluggable;
|
|
|
|
|
|
/**
|
|
* Class DcTag
|
|
*
|
|
* @property int $id
|
|
* @property int|null $category_id
|
|
* @property string $name
|
|
* @property int $pos
|
|
* @property string $slug
|
|
* @property Carbon|null $created_at
|
|
* @property Carbon|null $updated_at
|
|
*
|
|
* @property Collection|DcFileTag[] $dc_file_tags
|
|
*
|
|
* @package App\Models
|
|
*/
|
|
class DcTag extends Model
|
|
{
|
|
use Sluggable;
|
|
|
|
protected $table = 'dc_tags';
|
|
|
|
protected $casts = [
|
|
'category_id' => 'int',
|
|
'pos' => 'int',
|
|
'active' => 'bool'
|
|
];
|
|
|
|
protected $fillable = [
|
|
'category_id',
|
|
'name',
|
|
'pos',
|
|
'slug',
|
|
'active'
|
|
];
|
|
|
|
public function sluggable()
|
|
{
|
|
return [
|
|
'slug' => [
|
|
'source' => 'name'
|
|
]
|
|
];
|
|
}
|
|
|
|
public function dc_file_tags()
|
|
{
|
|
return $this->hasMany(DcFileTag::class, 'tag_id');
|
|
}
|
|
}
|