diff --git a/plugins/ahmadfatoni/apigenerator/controllers/api/CarddataController.php b/plugins/ahmadfatoni/apigenerator/controllers/api/CarddataController.php new file mode 100644 index 0000000..ce3d528 --- /dev/null +++ b/plugins/ahmadfatoni/apigenerator/controllers/api/CarddataController.php @@ -0,0 +1,99 @@ +Card_data = $Card_data; + $this->helpers = $helpers; + } + + public function index(){ + + $data = $this->Card_data->all()->toArray(); + + return $this->helpers->apiArrayResponseBuilder(200, 'success', $data); + } + + public function show($id){ + + $data = $this->Card_data::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->Card_data->{key($arr)} = $data; + next($arr); + } + + $validation = Validator::make($request->all(), $this->Card_data->rules); + + if( $validation->passes() ){ + $this->Card_data->save(); + return $this->helpers->apiArrayResponseBuilder(201, 'created', ['id' => $this->Card_data->id]); + }else{ + return $this->helpers->apiArrayResponseBuilder(400, 'fail', $validation->errors() ); + } + + } + + public function update($id, Request $request){ + + $status = $this->Card_data->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->Card_data->where('id',$id)->delete(); + + return $this->helpers->apiArrayResponseBuilder(200, 'success', 'Data has been deleted successfully.'); + } + + public function destroy($id){ + + $this->Card_data->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/CreditdataController.php b/plugins/ahmadfatoni/apigenerator/controllers/api/CreditdataController.php new file mode 100644 index 0000000..34a4a80 --- /dev/null +++ b/plugins/ahmadfatoni/apigenerator/controllers/api/CreditdataController.php @@ -0,0 +1,103 @@ +Credit_data = $Credit_data; + $this->helpers = $helpers; + } + + public function index(){ + + // $data = $this->Credit_data->all()->toArray(); + // $data = $this->Credit_data->with(['translations:sum,securing_return,source_of_repayment,repayment_method'])->get(); + $data = $this->Credit_data->with(['translations:locale,model_id,attribute_data'])->get(); + + return $this->helpers->apiArrayResponseBuilder(200, 'success', $data); + + // return response()->json($data, 200); + } + + public function show($id){ + + $data = $this->Credit_data::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->Credit_data->{key($arr)} = $data; + next($arr); + } + + $validation = Validator::make($request->all(), $this->Credit_data->rules); + + if( $validation->passes() ){ + $this->Credit_data->save(); + return $this->helpers->apiArrayResponseBuilder(201, 'created', ['id' => $this->Credit_data->id]); + }else{ + return $this->helpers->apiArrayResponseBuilder(400, 'fail', $validation->errors() ); + } + + } + + public function update($id, Request $request){ + + $status = $this->Credit_data->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->Credit_data->where('id',$id)->delete(); + + return $this->helpers->apiArrayResponseBuilder(200, 'success', 'Data has been deleted successfully.'); + } + + public function destroy($id){ + + $this->Credit_data->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 af652f8..4611e9b 100644 --- a/plugins/ahmadfatoni/apigenerator/routes.php +++ b/plugins/ahmadfatoni/apigenerator/routes.php @@ -4,5 +4,7 @@ Route::post('fatoni/generate/api', array('as' => 'fatoni.generate.api', 'uses' = Route::post('fatoni/update/api/{id}', array('as' => 'fatoni.update.api', 'uses' => 'AhmadFatoni\ApiGenerator\Controllers\ApiGeneratorController@updateApi')); Route::get('fatoni/delete/api/{id}', array('as' => 'fatoni.delete.api', 'uses' => 'AhmadFatoni\ApiGenerator\Controllers\ApiGeneratorController@deleteApi')); -Route::resource('user_sign_in', 'AhmadFatoni\ApiGenerator\Controllers\API\usersigninController', ['except' => ['destroy', 'create', 'edit']]); -Route::get('user_sign_in/{id}/delete', ['as' => 'user_sign_in.delete', 'uses' => 'AhmadFatoni\ApiGenerator\Controllers\API\usersigninController@destroy']); \ No newline at end of file +Route::resource('api/v1/credit_data', 'AhmadFatoni\ApiGenerator\Controllers\API\Credit dataController', ['except' => ['destroy', 'create', 'edit']]); +Route::get('api/v1/credit_data/{id}/delete', ['as' => 'api/v1/credit_data.delete', 'uses' => 'AhmadFatoni\ApiGenerator\Controllers\API\Credit dataController@destroy']); +Route::resource('api/v1/card_data', 'AhmadFatoni\ApiGenerator\Controllers\API\CarddataController', ['except' => ['destroy', 'create', 'edit']]); +Route::get('api/v1/card_data/{id}/delete', ['as' => 'api/v1/card_data.delete', 'uses' => 'AhmadFatoni\ApiGenerator\Controllers\API\CarddataController@destroy']); \ No newline at end of file diff --git a/plugins/atash/contact/controllers/CardDataController.php b/plugins/atash/contact/controllers/CardDataController.php new file mode 100644 index 0000000..414ca1d --- /dev/null +++ b/plugins/atash/contact/controllers/CardDataController.php @@ -0,0 +1,19 @@ + + = e(trans('backend::lang.form.create')) ?> + = e(trans('backend::lang.reorder.default_title')) ?> + + diff --git a/plugins/atash/contact/controllers/carddatacontroller/_reorder_toolbar.htm b/plugins/atash/contact/controllers/carddatacontroller/_reorder_toolbar.htm new file mode 100644 index 0000000..f902798 --- /dev/null +++ b/plugins/atash/contact/controllers/carddatacontroller/_reorder_toolbar.htm @@ -0,0 +1,3 @@ +
\ No newline at end of file diff --git a/plugins/atash/contact/controllers/carddatacontroller/config_form.yaml b/plugins/atash/contact/controllers/carddatacontroller/config_form.yaml new file mode 100644 index 0000000..032a3a1 --- /dev/null +++ b/plugins/atash/contact/controllers/carddatacontroller/config_form.yaml @@ -0,0 +1,10 @@ +name: CardDataController +form: $/atash/contact/models/card_data/fields.yaml +modelClass: Atash\Contact\Models\Card_data +defaultRedirect: atash/contact/carddatacontroller +create: + redirect: 'atash/contact/carddatacontroller/update/:id' + redirectClose: atash/contact/carddatacontroller +update: + redirect: atash/contact/carddatacontroller + redirectClose: atash/contact/carddatacontroller diff --git a/plugins/atash/contact/controllers/carddatacontroller/config_list.yaml b/plugins/atash/contact/controllers/carddatacontroller/config_list.yaml new file mode 100644 index 0000000..3004e4d --- /dev/null +++ b/plugins/atash/contact/controllers/carddatacontroller/config_list.yaml @@ -0,0 +1,12 @@ +list: $/atash/contact/models/card_data/columns.yaml +modelClass: Atash\Contact\Models\Card_data +title: CardDataController +noRecordsMessage: 'backend::lang.list.no_records' +showSetup: true +showCheckboxes: true +recordsPerPage: 20 +toolbar: + buttons: list_toolbar + search: + prompt: 'backend::lang.list.search_prompt' +recordUrl: 'atash/contact/carddatacontroller/update/:id' diff --git a/plugins/atash/contact/controllers/carddatacontroller/config_reorder.yaml b/plugins/atash/contact/controllers/carddatacontroller/config_reorder.yaml new file mode 100644 index 0000000..ad576ae --- /dev/null +++ b/plugins/atash/contact/controllers/carddatacontroller/config_reorder.yaml @@ -0,0 +1,4 @@ +title: CardDataController +modelClass: Atash\Contact\Models\Card_data +toolbar: + buttons: reorder_toolbar diff --git a/plugins/atash/contact/controllers/carddatacontroller/create.htm b/plugins/atash/contact/controllers/carddatacontroller/create.htm new file mode 100644 index 0000000..f04e707 --- /dev/null +++ b/plugins/atash/contact/controllers/carddatacontroller/create.htm @@ -0,0 +1,46 @@ + += e(trans('backend::lang.form.return_to_list')) ?>
+ \ No newline at end of file diff --git a/plugins/atash/contact/controllers/carddatacontroller/index.htm b/plugins/atash/contact/controllers/carddatacontroller/index.htm new file mode 100644 index 0000000..ea43a36 --- /dev/null +++ b/plugins/atash/contact/controllers/carddatacontroller/index.htm @@ -0,0 +1 @@ += $this->listRender() ?> diff --git a/plugins/atash/contact/controllers/carddatacontroller/preview.htm b/plugins/atash/contact/controllers/carddatacontroller/preview.htm new file mode 100644 index 0000000..1df81ee --- /dev/null +++ b/plugins/atash/contact/controllers/carddatacontroller/preview.htm @@ -0,0 +1,22 @@ + ++ + = e(trans('backend::lang.form.return_to_list')) ?> + +
\ No newline at end of file diff --git a/plugins/atash/contact/controllers/carddatacontroller/reorder.htm b/plugins/atash/contact/controllers/carddatacontroller/reorder.htm new file mode 100644 index 0000000..bdc0e01 --- /dev/null +++ b/plugins/atash/contact/controllers/carddatacontroller/reorder.htm @@ -0,0 +1,8 @@ + += e(trans('backend::lang.form.return_to_list')) ?>
+ \ No newline at end of file diff --git a/plugins/atash/contact/controllers/creditdatacontroller/_list_toolbar.htm b/plugins/atash/contact/controllers/creditdatacontroller/_list_toolbar.htm new file mode 100644 index 0000000..8c66b90 --- /dev/null +++ b/plugins/atash/contact/controllers/creditdatacontroller/_list_toolbar.htm @@ -0,0 +1,19 @@ += e(trans('backend::lang.form.return_to_list')) ?>
+ \ No newline at end of file diff --git a/plugins/atash/contact/controllers/creditdatacontroller/index.htm b/plugins/atash/contact/controllers/creditdatacontroller/index.htm new file mode 100644 index 0000000..ea43a36 --- /dev/null +++ b/plugins/atash/contact/controllers/creditdatacontroller/index.htm @@ -0,0 +1 @@ += $this->listRender() ?> diff --git a/plugins/atash/contact/controllers/creditdatacontroller/preview.htm b/plugins/atash/contact/controllers/creditdatacontroller/preview.htm new file mode 100644 index 0000000..3326082 --- /dev/null +++ b/plugins/atash/contact/controllers/creditdatacontroller/preview.htm @@ -0,0 +1,22 @@ + ++ + = e(trans('backend::lang.form.return_to_list')) ?> + +
\ No newline at end of file diff --git a/plugins/atash/contact/controllers/creditdatacontroller/reorder.htm b/plugins/atash/contact/controllers/creditdatacontroller/reorder.htm new file mode 100644 index 0000000..81816db --- /dev/null +++ b/plugins/atash/contact/controllers/creditdatacontroller/reorder.htm @@ -0,0 +1,8 @@ + +