public static function authenticate($token_key) { $token = Token::valid()->where("token", $token_key)->first(); if (!$token) { return null; } $user = $token->user; Sentinel::login($user); return $user; }
public static function loginByToken($token_string = null, $device_id = null, $device_os = null) { $token = Token::valid()->where("token", $token_string)->first(); if ($token) { $token->device_id = $device_id; $token->device_os = $device_os; $token->save(); return $token; } return false; }