Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function logout(Request $request){
- try {
- //code...
- $validator = Validator::make($request->all(), [
- 'token' => 'required',
- ]);
- if ($validator->fails()) {
- return $this->getResponse(406, $validator->errors()->first());
- }
- $token = Token::where('code', $request->token)->where('status', 1)->first();
- if (!$token) {
- return $this->getResponse(401, 'Token undefined');
- }
- $token->status = 0;
- $token->save();
- if (!$token) {
- return $this->getResponse(500);
- }
- return $this->getResponse(200);
- } catch (\Throwable $th) {
- //throw $th;
- return $this->getResponse(500);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment