| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- <?php
- namespace App\Models\UserModels;
- use Illuminate\Database\Eloquent\Model;
- use App\Models\Traits\Timestamp;
- class Role extends Model
- {
- use Timestamp;
- /**
- * 表名。
- *
- * @var string
- */
- protected $table = 'roles';
- /**
- * 与表关联的主键。
- *
- * @var string
- */
- protected $primaryKey = 'id';
- /**
- * 是否主动维护时间戳
- *
- * @var bool
- */
- public $timestamps = true;
- /**
- * 不能被批量赋值的属性
- *
- * @var array
- */
- protected $guarded = ['id', 'updated_at', 'created_at'];
- /**
- * 时间格式化
- * @var string[]
- */
- protected $casts = [
- 'created_at' => 'datetime:Y-m-d H:i:s',
- 'updated_at' => 'datetime:Y-m-d H:i:s'
- ];
- }
|