From 0e3993c61ab61e6b8e5a35f5070963f520fce4be Mon Sep 17 00:00:00 2001 From: root Date: Fri, 16 Dec 2022 07:03:18 +0000 Subject: [PATCH] from server afisha api --- .../apigenerator/controllers/api/AfishaController.php | 11 +++++++++++ plugins/ahmadfatoni/apigenerator/routes.php | 3 ++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/plugins/ahmadfatoni/apigenerator/controllers/api/AfishaController.php b/plugins/ahmadfatoni/apigenerator/controllers/api/AfishaController.php index 9600218ce..386f88c1a 100644 --- a/plugins/ahmadfatoni/apigenerator/controllers/api/AfishaController.php +++ b/plugins/ahmadfatoni/apigenerator/controllers/api/AfishaController.php @@ -28,6 +28,17 @@ class AfishaController extends Controller return $this->helpers->apiArrayResponseBuilder(200, 'success', $data); } + + public function show($id){ + + $data = $this->Afisha::find($id); + + if ($data){ + return $this->helpers->apiArrayResponseBuilder(200, 'success', [$data]); + } else { + $this->helpers->apiArrayResponseBuilder(404, 'not found', ['error' => 'Resource id=' . $id . ' could not be found']); + } + } } diff --git a/plugins/ahmadfatoni/apigenerator/routes.php b/plugins/ahmadfatoni/apigenerator/routes.php index 637cbb3d2..9f1e244b2 100644 --- a/plugins/ahmadfatoni/apigenerator/routes.php +++ b/plugins/ahmadfatoni/apigenerator/routes.php @@ -10,7 +10,8 @@ Route::resource('{locale}/api/posts', 'AhmadFatoni\ApiGenerator\Controllers\API\ Route::get('api/v2/categories', 'AhmadFatoni\ApiGenerator\Controllers\API\CategoriesV2Controller@index'); -Route::get('api/v2/afisha', 'AhmadFatoni\ApiGenerator\Controllers\API\AfishaController@index'); +//Route::get('api/v2/afisha', 'AhmadFatoni\ApiGenerator\Controllers\API\AfishaController@index'); +Route::resource('api/v2/afisha', 'AhmadFatoni\ApiGenerator\Controllers\API\AfishaController', ['except' => ['destroy', 'create', 'edit']]); Route::get('api/version',function (){ return '2.0.8';