php - Temporary property for Laravel Eloquent model -
i have laravel eloquent model user, has table username , email columns. need add property model on runtime, $user->secure. property doesn't need go database.
when add property , hit $user->save() error saying don't have database column 'secure'. can unset 'secure' before save somehow feels there should better way so. suggestions?
just add attribute class.
class user extends eloquent { public $secure; // ... }
note better declare protected , add corresponding accessors , mutators (getsecure
, setsecure
methods) model.
Comments
Post a Comment