Skip to content

Commit

Permalink
* 修改 model 默认值,默认关闭自动 timestamps & 字段保护功能
Browse files Browse the repository at this point in the history
  • Loading branch information
zhouyl committed Dec 6, 2017
1 parent e64cc0a commit f880e59
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
9 changes: 8 additions & 1 deletion Mellivora/Console/Commands/stubs/model.stub
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,19 @@ class DummyClass extends Model
*
* @var boolean
*/
public $timestamps = false;
public $timestamps = true;

/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [];

/**
* Indicates if all mass assignment is enabled.
*
* @var bool
*/
protected static $unguarded = false;
}
2 changes: 1 addition & 1 deletion Mellivora/Database/Eloquent/Concerns/GuardsAttributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ trait GuardsAttributes
*
* @var bool
*/
protected static $unguarded = false;
protected static $unguarded = true;

/**
* Get the fillable attributes for the model.
Expand Down
2 changes: 1 addition & 1 deletion Mellivora/Database/Eloquent/Concerns/HasTimestamps.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ trait HasTimestamps
*
* @var bool
*/
public $timestamps = true;
public $timestamps = false;

/**
* Update the model's update timestamp.
Expand Down
Empty file modified Mellivora/Support/Collection.php
100644 → 100755
Empty file.

0 comments on commit f880e59

Please sign in to comment.