first(); } catch (\Exception $e) { throw $e; } } /** * @param $userId * @param $session * @return bool * @throws \Exception */ public static function hasSession($userId, $session) { try { return static::raw('SELECT COUNT(*) AS `count` FROM `@THIS` WHERE userId = ? AND session = ?', [ $userId, $session ])->first()->get('count'); } catch (\Exception $e) { throw $e; } } /** * @param $userId * @return void * @throws \Exception */ public static function clearForUser($userId) { try { static::raw('DELETE FROM `@THIS` WHERE userId = ?', [ $userId ]); } catch (\Exception $e) { throw $e; } } }