public $table =
'posts';
//设置主键
//public $primaryKey = 'id';
//$dates属性里面包含的字段可以直接后面跟carbon类时间操作的任何方法,例如一个模型:
protected $dates = [
'delete_at'];
protected $table =
'users';
public $primaryKey =
'uid';
/*$attributes属性
默认给数据库里的一个字段赋值*/
protected $attributes = [
'user_limit' =>
100,
];
/**
* The attributes that are mass assignable.
*
* @var array
*/
//表示可以用create批量赋值的列
protected $fillable = [
'name',
'email',
'password'];
//不可以操作的字段
protected $guarded = [];
/**
* The attributes excluded from the model's JSON form.
*
* @var array
*/
//隐藏的字段
protected $hidden = [
'password',
'remember_token'];
转载请注明原文地址: https://www.6miu.com/read-41985.html