Logout Controller

This commit is contained in:
David Bomba 2021-04-27 16:03:21 +10:00
parent 48da709d6e
commit b0f5ca8638
2 changed files with 5 additions and 2 deletions

View File

@ -59,12 +59,14 @@ class LogoutController extends BaseController
*/ */
public function index(Request $request) public function index(Request $request)
{ {
CompanyToken::whereRaw('BINARY `token`= ?', [$request->header('X-API-TOKEN')]) CompanyToken::with('company')
->whereRaw('BINARY `token`= ?', [$request->header('X-API-TOKEN')])
->company ->company
->tokens() ->tokens()
->where('is_system', true)
->forceDelete(); ->forceDelete();
return response()->json(['message' => 'logged out.'], 200); return response()->json(['message' => 'All tokens deleted'], 200);
} }
} }

View File

@ -295,6 +295,7 @@ class MultiDB
/* This will set the database connection for the request */ /* This will set the database connection for the request */
config(['database.default' => $database]); config(['database.default' => $database]);
// for some reason this breaks everything _hard_
// DB::purge($database); // DB::purge($database);
// DB::reconnect($database); // DB::reconnect($database);
} }