id}::tokenable", 600, function () { return parent::tokenable()->first(); }); } public static function boot() { parent::boot(); // When updating, cancel normal update and manually update // the table asynchronously every hour. static::updating(function (self $personalAccessToken) { try { Cache::remember('PersonalAccessToken::lastUsgeUpdate', 3600, function () use ($personalAccessToken) { dispatch(new UpdatePersonalAccessToken($personalAccessToken, $personalAccessToken->getDirty())); return now(); }); } catch (Exception $e) { Log::critical($e->getMessage()); } return false; }); } }