From 711d2f7fa3245fd1fc9ca18c8cb837e7c7f37b50 Mon Sep 17 00:00:00 2001 From: Hasin Hayder Date: Fri, 20 May 2022 20:52:27 +0600 Subject: [PATCH] Hydra Controller --- app/Http/Controllers/HydraController.php | 20 ++++++++++++++++++++ routes/api.php | 4 ++++ 2 files changed, 24 insertions(+) create mode 100644 app/Http/Controllers/HydraController.php diff --git a/app/Http/Controllers/HydraController.php b/app/Http/Controllers/HydraController.php new file mode 100644 index 0000000..544bdc0 --- /dev/null +++ b/app/Http/Controllers/HydraController.php @@ -0,0 +1,20 @@ +"Welcome to Hydra, the zero config API boilerplate with roles and abilities for Laravel Sanctum. Please visit https://hasinhayder.github.io/hydra to know more." + ]); + } + + public function version(){ + return response([ + "message"=>"1.0.0" + ]); + } +} diff --git a/routes/api.php b/routes/api.php index 9298617..30fccc1 100644 --- a/routes/api.php +++ b/routes/api.php @@ -1,5 +1,6 @@ get('/user', function (Request $request) { return $request->user(); }); +Route::get('/hydra',[HydraController::class,'hydra']); +Route::get('/hydra/version',[HydraController::class,'version']); + Route::apiResource('users',UserController::class)->except(['edit','create'])->middleware(['auth:sanctum', 'abilities:admin,super-admin']); Route::post('users',[UserController::class,'store']); Route::post('login',[UserController::class,'login']);