50 lines
975 B
PHP
50 lines
975 B
PHP
<?php
|
|
|
|
namespace app\model;
|
|
|
|
|
|
use app\util\Util;
|
|
use config\constants\Constants;
|
|
use DateTimeInterface;
|
|
use Illuminate\Support\Carbon;
|
|
use support\Model;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class TagGroup extends Model
|
|
{
|
|
/**
|
|
* The table associated with the model.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $table = 'tag_group';
|
|
|
|
/**
|
|
* The primary key associated with the table.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $primaryKey = 'id';
|
|
|
|
//设置黑名单
|
|
protected $guarded = ['id','created_at','updated_at'];
|
|
|
|
// 指定日期字段存储格式为时间戳
|
|
protected $dateFormat = 'U';
|
|
|
|
/**
|
|
* Indicates if the model should be timestamped.
|
|
*
|
|
* @var bool
|
|
*/
|
|
public $timestamps = true;
|
|
|
|
use SoftDeletes;
|
|
protected $dates = ['deleted_at'];
|
|
|
|
// 定义与 Tag 的一对多关系
|
|
public function tags()
|
|
{
|
|
return $this->hasMany(Tag::class, 'group_id', 'id');
|
|
}
|
|
} |