77 lines
2.2 KiB
PHP
77 lines
2.2 KiB
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
|
|
* @property bool $active
|
|
* @property-read int|null $dc_file_tags_count
|
|
* @method static \Illuminate\Database\Eloquent\Builder|DcTag findSimilarSlugs(string $attribute, array $config, string $slug)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|DcTag newModelQuery()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|DcTag newQuery()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|DcTag query()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|DcTag whereActive($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|DcTag whereCategoryId($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|DcTag whereCreatedAt($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|DcTag whereId($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|DcTag whereName($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|DcTag wherePos($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|DcTag whereSlug($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|DcTag whereUpdatedAt($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|DcTag withUniqueSlugConstraints(\Illuminate\Database\Eloquent\Model $model, string $attribute, array $config, string $slug)
|
|
* @mixin \Eloquent
|
|
*/
|
|
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() : array
|
|
{
|
|
return [
|
|
'slug' => [
|
|
'source' => 'name'
|
|
]
|
|
];
|
|
}
|
|
|
|
public function dc_file_tags()
|
|
{
|
|
return $this->hasMany(DcFileTag::class, 'tag_id');
|
|
}
|
|
}
|