123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- <?php
- namespace App\Models;
- // use Illuminate\Contracts\Authenticate\MustVerifyEmail;
- use DateTimeInterface;
- use Illuminate\Database\Eloquent\Factories\HasFactory;
- use Illuminate\Database\Eloquent\Model;
- use Illuminate\Foundation\Auth\User as Authenticatable;
- use Illuminate\Notifications\Notifiable;
- use Laravel\Sanctum\HasApiTokens;
- use Tymon\JWTAuth\Contracts\JWTSubject;
- class Role extends Model
- {
- use HasFactory;
- // 设置表名
- protected $table = 'role';
- // 设置主键
- // public $primaryKey = 'id';
- /**
- * 自动生成时间戳
- */
- // public $timestamps = FALSE;
- const CREATED_AT = 'create_time';
- const UPDATED_AT = 'update_time';
- // 自定义软删除字段 默认 deleted_at
- // const DELETED_AT = 'delete_at';
- /**
- * 日期时间的存储格式
- *
- * @var string
- */
- // protected $dateFormat = 'Y-m-d H:i:s';
- /**
- * The attributes that are mass assignable.
- *
- * @var array<int, string>
- */
- protected $fillable = [];
- /**
- * The attributes that should be hidden for serialization.
- *
- * @var array<int, string>
- */
- protected $hidden = [];
- /**
- * The attributes that should be cast.
- *
- * @var array<string, string>
- */
- protected $casts = [
- // 'create_time' => 'datetime', //'datetime:Y-m-d H:i:s'
- // 'password' => 'hashed',
- ];
- protected function serializeDate(DateTimeInterface $date): string
- {
- return $date->format('Y-m-d H:i:s');
- }
- }
|