attributes['password'] = bcrypt($value); } // before create admin, generate api_token public static function boot() { parent::boot(); self::creating(function ($admin) { $admin->api_token = Str::random(60); }); } }