+ Add logout route

This commit is contained in:
Djery-Tom 2020-05-16 09:06:41 +01:00
parent f7dc93f24c
commit 9edd74eabf
61 changed files with 17 additions and 2 deletions

0
.editorconfig Normal file → Executable file
View File

0
.env.example Normal file → Executable file
View File

0
.gitignore vendored Normal file → Executable file
View File

0
.htaccess Normal file → Executable file
View File

0
.styleci.yml Normal file → Executable file
View File

0
README.md Normal file → Executable file
View File

0
app/Console/Commands/.gitkeep Normal file → Executable file
View File

0
app/Console/Kernel.php Normal file → Executable file
View File

0
app/Events/Event.php Normal file → Executable file
View File

0
app/Events/ExampleEvent.php Normal file → Executable file
View File

0
app/Exceptions/Handler.php Normal file → Executable file
View File

12
app/Http/Controllers/AccessTokenController.php Normal file → Executable file
View File

@ -5,7 +5,9 @@ use App\Models\AgentPlus;
use App\Models\Country;
use App\Models\Network;
use App\Models\User;
use App\Traits\ApiResponser;
use Illuminate\Http\Response;
use Illuminate\Http\Request;
use Psr\Http\Message\ServerRequestInterface;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use League\OAuth2\Server\Exception\OAuthServerException;
@ -15,6 +17,7 @@ use \Laravel\Passport\Http\Controllers\AccessTokenController as ATC;
// Completely overrides Laravel\Passport\Http\Controllers\AccessTokenController
class AccessTokenController extends ATC
{
use ApiResponser;
public function issueToken(ServerRequestInterface $request)
{
@ -77,4 +80,13 @@ class AccessTokenController extends ATC
}
}
public function logout(Request $request) {
// Auth::user()->tokens->each(function($token, $key) {
// $token->delete();
// });
$request->user()->token()->delete();
return $this->successResponse(trans('errors.logout'));
}
}

0
app/Http/Controllers/Controller.php Normal file → Executable file
View File

0
app/Http/Controllers/ExampleController.php Normal file → Executable file
View File

0
app/Http/Controllers/MobileBackendController.php Normal file → Executable file
View File

0
app/Http/Controllers/MobileBackendTestController.php Normal file → Executable file
View File

0
app/Http/Controllers/WalletServiceController.php Normal file → Executable file
View File

0
app/Http/Middleware/Authenticate.php Normal file → Executable file
View File

0
app/Http/Middleware/ExampleMiddleware.php Normal file → Executable file
View File

0
app/Http/Middleware/Localization.php Normal file → Executable file
View File

0
app/Jobs/ExampleJob.php Normal file → Executable file
View File

0
app/Jobs/Job.php Normal file → Executable file
View File

0
app/Listeners/ExampleListener.php Normal file → Executable file
View File

0
app/Models/AgentPlus.php Normal file → Executable file
View File

0
app/Models/Country.php Normal file → Executable file
View File

0
app/Models/Network.php Normal file → Executable file
View File

0
app/Models/User.php Normal file → Executable file
View File

0
app/Models/UsersCredentials.php Normal file → Executable file
View File

0
app/Providers/AppServiceProvider.php Normal file → Executable file
View File

0
app/Providers/AuthServiceProvider.php Normal file → Executable file
View File

0
app/Providers/EventServiceProvider.php Normal file → Executable file
View File

0
app/Services/MobileBackendService.php Normal file → Executable file
View File

0
app/Services/MobileBackendTestService.php Normal file → Executable file
View File

0
app/Services/WalletService.php Normal file → Executable file
View File

0
app/Traits/ApiResponser.php Normal file → Executable file
View File

0
app/Traits/ConsumesExternalService.php Normal file → Executable file
View File

0
app/User.php.save Normal file → Executable file
View File

0
bootstrap/app.php Normal file → Executable file
View File

0
composer.json Normal file → Executable file
View File

0
composer.lock generated Normal file → Executable file
View File

0
config/auth.php Normal file → Executable file
View File

0
config/services.php Normal file → Executable file
View File

0
database/factories/ModelFactory.php Normal file → Executable file
View File

0
database/migrations/.gitkeep Normal file → Executable file
View File

0
database/seeds/DatabaseSeeder.php Normal file → Executable file
View File

0
phpunit.xml Normal file → Executable file
View File

0
public/.htaccess Normal file → Executable file
View File

0
public/index.php Normal file → Executable file
View File

3
resources/lang/en/errors.php Normal file → Executable file
View File

@ -1,5 +1,6 @@
<?php
return [
'model_not_found' => 'Does not exist any instance of :model with given id',
'unexpected_error'=> 'Unexpected error. Try later'
'unexpected_error'=> 'Unexpected error. Try later',
'logout' => 'Successfully logged out'
];

3
resources/lang/fr/errors.php Normal file → Executable file
View File

@ -1,5 +1,6 @@
<?php
return [
'model_not_found' => 'Il n\'existe aucune instance de :model avec l\'id donné',
'unexpected_error'=> 'Erreur inattendue. Essayer plus tard'
'unexpected_error'=> 'Erreur inattendue. Essayer plus tard',
'logout' => 'Déconnexion réussie'
];

0
resources/views/.gitkeep Normal file → Executable file
View File

1
routes/web.php Normal file → Executable file
View File

@ -14,6 +14,7 @@
//$router->get('/', function () use ($router) {
// return $router->app->version();
//});
$router->post('/logout',['uses'=>'AccessTokenController@logout','middleware' => 'auth:api']);
/**
* Routes for MobileBackend

0
storage/app/.gitignore vendored Normal file → Executable file
View File

0
storage/framework/cache/.gitignore vendored Normal file → Executable file
View File

0
storage/framework/cache/data/.gitignore vendored Normal file → Executable file
View File

0
storage/framework/views/.gitignore vendored Normal file → Executable file
View File

0
storage/logs/.gitignore vendored Normal file → Executable file
View File

0
storage/oauth-private.key Normal file → Executable file
View File

0
storage/oauth-public.key Normal file → Executable file
View File

0
tests/ExampleTest.php Normal file → Executable file
View File

0
tests/TestCase.php Normal file → Executable file
View File