'datetime', ]; /** * The attributes that should be cast to Enums. * * @var array */ protected $enumCasts = [ 'role' => UserRole::class, ]; /** * Perform any actions required after the model boots. * * @return void */ protected static function booted() { // * EVENT CLOSURES. static::creating(function (User $user) { if (Hash::needsRehash($user->password)) { $user->password = Hash::make($user->password); } }); static::updating(function (User $user) { if (Hash::needsRehash($user->password)) { $user->password = Hash::make($user->password); } }); } // * RELATIONSHIPS /** * hasMany order relation * * @return \Illuminate\Database\Eloquent\Relations\HasMany */ public function orders() { return $this->hasMany('App\Models\Shop\Order', 'user_id'); } }