diff --git a/plugins/ahmadfatoni/apigenerator/controllers/api/contactController.php b/plugins/ahmadfatoni/apigenerator/controllers/api/contactController.php new file mode 100644 index 0000000..a9f3ef2 --- /dev/null +++ b/plugins/ahmadfatoni/apigenerator/controllers/api/contactController.php @@ -0,0 +1,99 @@ +Contacts = $Contacts; + $this->helpers = $helpers; + } + + public function index(){ + + $data = $this->Contacts->all()->toArray(); + + return $this->helpers->apiArrayResponseBuilder(200, 'success', $data); + } + + public function show($id){ + + $data = $this->Contacts::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']); + } + + } + + public function store(Request $request){ + + $arr = $request->all(); + + while ( $data = current($arr)) { + $this->Contacts->{key($arr)} = $data; + next($arr); + } + + $validation = Validator::make($request->all(), $this->Contacts->rules); + + if( $validation->passes() ){ + $this->Contacts->save(); + return $this->helpers->apiArrayResponseBuilder(201, 'created', ['id' => $this->Contacts->id]); + }else{ + return $this->helpers->apiArrayResponseBuilder(400, 'fail', $validation->errors() ); + } + + } + + public function update($id, Request $request){ + + $status = $this->Contacts->where('id',$id)->update($data); + + if( $status ){ + + return $this->helpers->apiArrayResponseBuilder(200, 'success', 'Data has been updated successfully.'); + + }else{ + + return $this->helpers->apiArrayResponseBuilder(400, 'bad request', 'Error, data failed to update.'); + + } + } + + public function delete($id){ + + $this->Contacts->where('id',$id)->delete(); + + return $this->helpers->apiArrayResponseBuilder(200, 'success', 'Data has been deleted successfully.'); + } + + public function destroy($id){ + + $this->Contacts->where('id',$id)->delete(); + + return $this->helpers->apiArrayResponseBuilder(200, 'success', 'Data has been deleted successfully.'); + } + + + public static function getAfterFilters() {return [];} + public static function getBeforeFilters() {return [];} + public static function getMiddleware() {return [];} + public function callAction($method, $parameters=false) { + return call_user_func_array(array($this, $method), $parameters); + } + +} \ No newline at end of file diff --git a/plugins/ahmadfatoni/apigenerator/controllers/api/mainServicesController.php b/plugins/ahmadfatoni/apigenerator/controllers/api/mainServicesController.php new file mode 100644 index 0000000..8f12bc0 --- /dev/null +++ b/plugins/ahmadfatoni/apigenerator/controllers/api/mainServicesController.php @@ -0,0 +1,99 @@ +MainServices = $MainServices; + $this->helpers = $helpers; + } + + public function index(){ + + $data = $this->MainServices->all()->toArray(); + + return $this->helpers->apiArrayResponseBuilder(200, 'success', $data); + } + + public function show($id){ + + $data = $this->MainServices::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']); + } + + } + + public function store(Request $request){ + + $arr = $request->all(); + + while ( $data = current($arr)) { + $this->MainServices->{key($arr)} = $data; + next($arr); + } + + $validation = Validator::make($request->all(), $this->MainServices->rules); + + if( $validation->passes() ){ + $this->MainServices->save(); + return $this->helpers->apiArrayResponseBuilder(201, 'created', ['id' => $this->MainServices->id]); + }else{ + return $this->helpers->apiArrayResponseBuilder(400, 'fail', $validation->errors() ); + } + + } + + public function update($id, Request $request){ + + $status = $this->MainServices->where('id',$id)->update($data); + + if( $status ){ + + return $this->helpers->apiArrayResponseBuilder(200, 'success', 'Data has been updated successfully.'); + + }else{ + + return $this->helpers->apiArrayResponseBuilder(400, 'bad request', 'Error, data failed to update.'); + + } + } + + public function delete($id){ + + $this->MainServices->where('id',$id)->delete(); + + return $this->helpers->apiArrayResponseBuilder(200, 'success', 'Data has been deleted successfully.'); + } + + public function destroy($id){ + + $this->MainServices->where('id',$id)->delete(); + + return $this->helpers->apiArrayResponseBuilder(200, 'success', 'Data has been deleted successfully.'); + } + + + public static function getAfterFilters() {return [];} + public static function getBeforeFilters() {return [];} + public static function getMiddleware() {return [];} + public function callAction($method, $parameters=false) { + return call_user_func_array(array($this, $method), $parameters); + } + +} \ No newline at end of file diff --git a/plugins/ahmadfatoni/apigenerator/routes.php b/plugins/ahmadfatoni/apigenerator/routes.php index bc49b1e..8bcaea4 100644 --- a/plugins/ahmadfatoni/apigenerator/routes.php +++ b/plugins/ahmadfatoni/apigenerator/routes.php @@ -6,11 +6,15 @@ Route::get('fatoni/delete/api/{id}', array('as' => 'fatoni.delete.api', 'uses' = Route::resource('api/v1/pages', 'AhmadFatoni\ApiGenerator\Controllers\API\PagesController', ['except' => ['destroy', 'create', 'edit']]); Route::get('api/v1/pages/{id}/delete', ['as' => 'api/v1/pages.delete', 'uses' => 'AhmadFatoni\ApiGenerator\Controllers\API\PagesController@destroy']); +Route::resource('api/v1/home-services', 'AhmadFatoni\ApiGenerator\Controllers\API\ServicesController', ['except' => ['destroy', 'create', 'edit']]); +Route::get('api/v1/home-services/{id}/delete', ['as' => 'api/v1/home-services.delete', 'uses' => 'AhmadFatoni\ApiGenerator\Controllers\API\ServicesController@destroy']); Route::resource('api/v1/home-projects', 'AhmadFatoni\ApiGenerator\Controllers\API\ProjectsController', ['except' => ['destroy', 'create', 'edit']]); Route::get('api/v1/home-projects/{id}/delete', ['as' => 'api/v1/home-projects.delete', 'uses' => 'AhmadFatoni\ApiGenerator\Controllers\API\ProjectsController@destroy']); Route::resource('api/v1/partners', 'AhmadFatoni\ApiGenerator\Controllers\API\PartnersController', ['except' => ['destroy', 'create', 'edit']]); Route::get('api/v1/partners/{id}/delete', ['as' => 'api/v1/partners.delete', 'uses' => 'AhmadFatoni\ApiGenerator\Controllers\API\PartnersController@destroy']); Route::resource('api/v1/cartoons', 'AhmadFatoni\ApiGenerator\Controllers\API\CartoonsController', ['except' => ['destroy', 'create', 'edit']]); Route::get('api/v1/cartoons/{id}/delete', ['as' => 'api/v1/cartoons.delete', 'uses' => 'AhmadFatoni\ApiGenerator\Controllers\API\CartoonsController@destroy']); -Route::resource('api/v1/home-services', 'AhmadFatoni\ApiGenerator\Controllers\API\ServicesController', ['except' => ['destroy', 'create', 'edit']]); -Route::get('api/v1/home-services/{id}/delete', ['as' => 'api/v1/home-services.delete', 'uses' => 'AhmadFatoni\ApiGenerator\Controllers\API\ServicesController@destroy']); \ No newline at end of file +Route::resource('api/v1/mainServices', 'AhmadFatoni\ApiGenerator\Controllers\API\mainServicesController', ['except' => ['destroy', 'create', 'edit']]); +Route::get('api/v1/mainServices/{id}/delete', ['as' => 'api/v1/mainServices.delete', 'uses' => 'AhmadFatoni\ApiGenerator\Controllers\API\mainServicesController@destroy']); +Route::resource('api/v1/contact', 'AhmadFatoni\ApiGenerator\Controllers\API\contactController', ['except' => ['destroy', 'create', 'edit']]); +Route::get('api/v1/contact/{id}/delete', ['as' => 'api/v1/contact.delete', 'uses' => 'AhmadFatoni\ApiGenerator\Controllers\API\contactController@destroy']); \ No newline at end of file diff --git a/plugins/tps/tps/controllers/ContactsController.php b/plugins/tps/tps/controllers/ContactsController.php new file mode 100644 index 0000000..4494e74 --- /dev/null +++ b/plugins/tps/tps/controllers/ContactsController.php @@ -0,0 +1,23 @@ + + + = e(trans('backend::lang.form.create')) ?> + + + diff --git a/plugins/tps/tps/controllers/contactscontroller/config_form.yaml b/plugins/tps/tps/controllers/contactscontroller/config_form.yaml new file mode 100644 index 0000000..1035fd6 --- /dev/null +++ b/plugins/tps/tps/controllers/contactscontroller/config_form.yaml @@ -0,0 +1,10 @@ +name: ContactsController +form: $/tps/tps/models/contacts/fields.yaml +modelClass: Tps\Tps\Models\Contacts +defaultRedirect: tps/tps/contactscontroller +create: + redirect: 'tps/tps/contactscontroller/update/:id' + redirectClose: tps/tps/contactscontroller +update: + redirect: tps/tps/contactscontroller + redirectClose: tps/tps/contactscontroller diff --git a/plugins/tps/tps/controllers/contactscontroller/config_list.yaml b/plugins/tps/tps/controllers/contactscontroller/config_list.yaml new file mode 100644 index 0000000..f995d33 --- /dev/null +++ b/plugins/tps/tps/controllers/contactscontroller/config_list.yaml @@ -0,0 +1,12 @@ +list: $/tps/tps/models/contacts/columns.yaml +modelClass: Tps\Tps\Models\Contacts +title: ContactsController +noRecordsMessage: 'backend::lang.list.no_records' +showSetup: true +showCheckboxes: true +recordsPerPage: 20 +toolbar: + buttons: list_toolbar + search: + prompt: 'backend::lang.list.search_prompt' +recordUrl: 'tps/tps/contactscontroller/update/:id' diff --git a/plugins/tps/tps/controllers/contactscontroller/create.php b/plugins/tps/tps/controllers/contactscontroller/create.php new file mode 100644 index 0000000..c99607a --- /dev/null +++ b/plugins/tps/tps/controllers/contactscontroller/create.php @@ -0,0 +1,46 @@ + +
= e(trans('backend::lang.form.return_to_list')) ?>
+ \ No newline at end of file diff --git a/plugins/tps/tps/controllers/contactscontroller/index.php b/plugins/tps/tps/controllers/contactscontroller/index.php new file mode 100644 index 0000000..ea43a36 --- /dev/null +++ b/plugins/tps/tps/controllers/contactscontroller/index.php @@ -0,0 +1 @@ += $this->listRender() ?> diff --git a/plugins/tps/tps/controllers/contactscontroller/preview.php b/plugins/tps/tps/controllers/contactscontroller/preview.php new file mode 100644 index 0000000..c28e9fb --- /dev/null +++ b/plugins/tps/tps/controllers/contactscontroller/preview.php @@ -0,0 +1,22 @@ + ++ + = e(trans('backend::lang.form.return_to_list')) ?> + +
\ No newline at end of file diff --git a/plugins/tps/tps/controllers/contactscontroller/update.php b/plugins/tps/tps/controllers/contactscontroller/update.php new file mode 100644 index 0000000..d45c798 --- /dev/null +++ b/plugins/tps/tps/controllers/contactscontroller/update.php @@ -0,0 +1,54 @@ + += e(trans('backend::lang.form.return_to_list')) ?>
+ \ No newline at end of file diff --git a/plugins/tps/tps/controllers/mainservicescontroller/_list_toolbar.php b/plugins/tps/tps/controllers/mainservicescontroller/_list_toolbar.php new file mode 100644 index 0000000..724917c --- /dev/null +++ b/plugins/tps/tps/controllers/mainservicescontroller/_list_toolbar.php @@ -0,0 +1,16 @@ + diff --git a/plugins/tps/tps/controllers/mainservicescontroller/config_form.yaml b/plugins/tps/tps/controllers/mainservicescontroller/config_form.yaml new file mode 100644 index 0000000..7ee5541 --- /dev/null +++ b/plugins/tps/tps/controllers/mainservicescontroller/config_form.yaml @@ -0,0 +1,10 @@ +name: MainServicesController +form: $/tps/tps/models/mainservices/fields.yaml +modelClass: Tps\Tps\Models\MainServices +defaultRedirect: tps/tps/mainservicescontroller +create: + redirect: 'tps/tps/mainservicescontroller/update/:id' + redirectClose: tps/tps/mainservicescontroller +update: + redirect: tps/tps/mainservicescontroller + redirectClose: tps/tps/mainservicescontroller diff --git a/plugins/tps/tps/controllers/mainservicescontroller/config_list.yaml b/plugins/tps/tps/controllers/mainservicescontroller/config_list.yaml new file mode 100644 index 0000000..c9e8176 --- /dev/null +++ b/plugins/tps/tps/controllers/mainservicescontroller/config_list.yaml @@ -0,0 +1,12 @@ +list: $/tps/tps/models/mainservices/columns.yaml +modelClass: Tps\Tps\Models\MainServices +title: MainServicesController +noRecordsMessage: 'backend::lang.list.no_records' +showSetup: true +showCheckboxes: true +recordsPerPage: 20 +toolbar: + buttons: list_toolbar + search: + prompt: 'backend::lang.list.search_prompt' +recordUrl: 'tps/tps/mainservicescontroller/update/:id' diff --git a/plugins/tps/tps/controllers/mainservicescontroller/create.php b/plugins/tps/tps/controllers/mainservicescontroller/create.php new file mode 100644 index 0000000..30276aa --- /dev/null +++ b/plugins/tps/tps/controllers/mainservicescontroller/create.php @@ -0,0 +1,46 @@ + += e(trans('backend::lang.form.return_to_list')) ?>
+ \ No newline at end of file diff --git a/plugins/tps/tps/controllers/mainservicescontroller/index.php b/plugins/tps/tps/controllers/mainservicescontroller/index.php new file mode 100644 index 0000000..ea43a36 --- /dev/null +++ b/plugins/tps/tps/controllers/mainservicescontroller/index.php @@ -0,0 +1 @@ += $this->listRender() ?> diff --git a/plugins/tps/tps/controllers/mainservicescontroller/preview.php b/plugins/tps/tps/controllers/mainservicescontroller/preview.php new file mode 100644 index 0000000..8435713 --- /dev/null +++ b/plugins/tps/tps/controllers/mainservicescontroller/preview.php @@ -0,0 +1,22 @@ + ++ + = e(trans('backend::lang.form.return_to_list')) ?> + +
\ No newline at end of file diff --git a/plugins/tps/tps/controllers/mainservicescontroller/update.php b/plugins/tps/tps/controllers/mainservicescontroller/update.php new file mode 100644 index 0000000..e2001fd --- /dev/null +++ b/plugins/tps/tps/controllers/mainservicescontroller/update.php @@ -0,0 +1,54 @@ + +