*/ protected $fillable = [ 'firstname', 'lastname', 'email', 'password', ]; /** * The attributes that should be hidden for serialization. * * @var array */ protected $hidden = [ 'password', 'remember_token', ]; /** * The attributes that should be cast. * * @var array */ protected $casts = [ 'email_verified_at' => 'datetime', 'last_connection' => 'datetime', ]; /** * Perform any actions required after the model boots. * * @return void */ protected static function booted() { // * EVENT CLOSURES. static::creating(function (self $user) { if (Hash::needsRehash($user->password)) { $user->password = Hash::make($user->password); } $user->remember_token = Str::random(10); }); static::updating(function (self $user) { if (Hash::needsRehash($user->password)) { $user->password = Hash::make($user->password); } $user->remember_token = Str::random(10); }); } }