From dd9a10febdcf3ca2a26820c79408270a18ed2e92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=BCneyt=20=C5=9Eent=C3=BCrk?= Date: Sun, 30 May 2021 02:43:12 +0300 Subject: [PATCH] Changed api show and store method.. --- app/Http/Controllers/Api/Auth/Permissions.php | 4 ++-- app/Http/Controllers/Api/Auth/Roles.php | 4 ++-- app/Http/Controllers/Api/Auth/Users.php | 4 ++-- app/Http/Controllers/Api/Banking/Accounts.php | 4 ++-- app/Http/Controllers/Api/Banking/Reconciliations.php | 4 ++-- app/Http/Controllers/Api/Banking/Transactions.php | 4 ++-- app/Http/Controllers/Api/Banking/Transfers.php | 4 ++-- app/Http/Controllers/Api/Common/Companies.php | 4 ++-- app/Http/Controllers/Api/Common/Contacts.php | 4 ++-- app/Http/Controllers/Api/Common/Dashboards.php | 4 ++-- app/Http/Controllers/Api/Common/Items.php | 4 ++-- app/Http/Controllers/Api/Common/Reports.php | 4 ++-- app/Http/Controllers/Api/Document/DocumentTransactions.php | 4 ++-- app/Http/Controllers/Api/Document/Documents.php | 6 +++--- app/Http/Controllers/Api/Settings/Categories.php | 4 ++-- app/Http/Controllers/Api/Settings/Currencies.php | 4 ++-- app/Http/Controllers/Api/Settings/Settings.php | 6 +++--- app/Http/Controllers/Api/Settings/Taxes.php | 4 ++-- 18 files changed, 38 insertions(+), 38 deletions(-) diff --git a/app/Http/Controllers/Api/Auth/Permissions.php b/app/Http/Controllers/Api/Auth/Permissions.php index 530d24c2a..76b242ae5 100644 --- a/app/Http/Controllers/Api/Auth/Permissions.php +++ b/app/Http/Controllers/Api/Auth/Permissions.php @@ -32,7 +32,7 @@ class Permissions extends ApiController */ public function show(Permission $permission) { - return $this->response->item($permission, new Transformer()); + return $this->item($permission, new Transformer()); } /** @@ -45,7 +45,7 @@ class Permissions extends ApiController { $permission = $this->dispatch(new CreatePermission($request)); - return $this->response->created(route('api.permissions.show', $permission->id)); + return $this->response->created(route('api.permissions.show', $permission->id), $this->item($permission, new Transformer())); } /** diff --git a/app/Http/Controllers/Api/Auth/Roles.php b/app/Http/Controllers/Api/Auth/Roles.php index d9ad12c2c..fc88fc5ab 100644 --- a/app/Http/Controllers/Api/Auth/Roles.php +++ b/app/Http/Controllers/Api/Auth/Roles.php @@ -32,7 +32,7 @@ class Roles extends ApiController */ public function show(Role $role) { - return $this->response->item($role, new Transformer()); + return $this->item($role, new Transformer()); } /** @@ -45,7 +45,7 @@ class Roles extends ApiController { $role = $this->dispatch(new CreateRole($request)); - return $this->response->created(route('api.roles.show', $role->id)); + return $this->response->created(route('api.roles.show', $role->id), $this->item($role, new Transformer())); } /** diff --git a/app/Http/Controllers/Api/Auth/Users.php b/app/Http/Controllers/Api/Auth/Users.php index 6f4987b32..0610b6c64 100644 --- a/app/Http/Controllers/Api/Auth/Users.php +++ b/app/Http/Controllers/Api/Auth/Users.php @@ -39,7 +39,7 @@ class Users extends ApiController $user = User::with('companies', 'permissions', 'roles')->where('email', $id)->first(); } - return $this->response->item($user, new Transformer()); + return $this->item($user, new Transformer()); } /** @@ -52,7 +52,7 @@ class Users extends ApiController { $user = $this->dispatch(new CreateUser($request)); - return $this->response->created(route('api.users.show', $user->id)); + return $this->response->created(route('api.users.show', $user->id), $this->item($user, new Transformer())); } /** diff --git a/app/Http/Controllers/Api/Banking/Accounts.php b/app/Http/Controllers/Api/Banking/Accounts.php index 9b1490583..6471ef077 100644 --- a/app/Http/Controllers/Api/Banking/Accounts.php +++ b/app/Http/Controllers/Api/Banking/Accounts.php @@ -39,7 +39,7 @@ class Accounts extends ApiController $account = Account::where('number', $id)->first(); } - return $this->response->item($account, new Transformer()); + return $this->item($account, new Transformer()); } /** @@ -52,7 +52,7 @@ class Accounts extends ApiController { $account = $this->dispatch(new CreateAccount($request)); - return $this->response->created(route('api.accounts.show', $account->id)); + return $this->response->created(route('api.accounts.show', $account->id), $this->item($account, new Transformer())); } /** diff --git a/app/Http/Controllers/Api/Banking/Reconciliations.php b/app/Http/Controllers/Api/Banking/Reconciliations.php index e45d53d21..e4f2e2936 100644 --- a/app/Http/Controllers/Api/Banking/Reconciliations.php +++ b/app/Http/Controllers/Api/Banking/Reconciliations.php @@ -32,7 +32,7 @@ class Reconciliations extends ApiController */ public function show(Reconciliation $reconciliation) { - return $this->response->item($reconciliation, new Transformer()); + return $this->item($reconciliation, new Transformer()); } /** @@ -45,7 +45,7 @@ class Reconciliations extends ApiController { $reconciliation = $this->dispatch(new CreateReconciliation($request)); - return $this->response->created(route('api.reconciliations.show', $reconciliation->id)); + return $this->response->created(route('api.reconciliations.show', $reconciliation->id), $this->item($reconciliation, new Transformer())); } /** diff --git a/app/Http/Controllers/Api/Banking/Transactions.php b/app/Http/Controllers/Api/Banking/Transactions.php index 7ad0175d9..6861130ea 100644 --- a/app/Http/Controllers/Api/Banking/Transactions.php +++ b/app/Http/Controllers/Api/Banking/Transactions.php @@ -32,7 +32,7 @@ class Transactions extends ApiController */ public function show(Transaction $transaction) { - return $this->response->item($transaction, new Transformer()); + return $this->item($transaction, new Transformer()); } /** @@ -45,7 +45,7 @@ class Transactions extends ApiController { $transaction = $this->dispatch(new CreateTransaction($request)); - return $this->response->created(route('api.transactions.show', $transaction->id)); + return $this->response->created(route('api.transactions.show', $transaction->id), $this->item($transaction, new Transformer())); } /** diff --git a/app/Http/Controllers/Api/Banking/Transfers.php b/app/Http/Controllers/Api/Banking/Transfers.php index 41e41ce9e..841926940 100644 --- a/app/Http/Controllers/Api/Banking/Transfers.php +++ b/app/Http/Controllers/Api/Banking/Transfers.php @@ -62,7 +62,7 @@ class Transfers extends ApiController */ public function show(Transfer $transfer) { - return $this->response->item($transfer, new Transformer()); + return $this->item($transfer, new Transformer()); } /** @@ -75,7 +75,7 @@ class Transfers extends ApiController { $transfer = $this->dispatch(new CreateTransfer($request)); - return $this->response->created(route('api.transfers.show', $transfer->id)); + return $this->response->created(route('api.transfers.show', $transfer->id), $this->item($transfer, new Transformer())); } /** diff --git a/app/Http/Controllers/Api/Common/Companies.php b/app/Http/Controllers/Api/Common/Companies.php index 4f5b8a5a3..022b09842 100644 --- a/app/Http/Controllers/Api/Common/Companies.php +++ b/app/Http/Controllers/Api/Common/Companies.php @@ -40,7 +40,7 @@ class Companies extends ApiController // Check if user can access company $this->canAccess($company); - return $this->response->item($company, new Transformer()); + return $this->item($company, new Transformer()); } catch (\Exception $e) { $this->response->errorUnauthorized($e->getMessage()); } @@ -56,7 +56,7 @@ class Companies extends ApiController { $company = $this->dispatch(new CreateCompany($request)); - return $this->response->created(route('api.companies.show', $company->id)); + return $this->response->created(route('api.companies.show', $company->id), $this->item($company, new Transformer())); } /** diff --git a/app/Http/Controllers/Api/Common/Contacts.php b/app/Http/Controllers/Api/Common/Contacts.php index b8ea62159..8a5a00790 100644 --- a/app/Http/Controllers/Api/Common/Contacts.php +++ b/app/Http/Controllers/Api/Common/Contacts.php @@ -42,7 +42,7 @@ class Contacts extends ApiController $contact = Contact::where('email', $id)->first(); } - return $this->response->item($contact, new Transformer()); + return $this->item($contact, new Transformer()); } /** @@ -55,7 +55,7 @@ class Contacts extends ApiController { $contact = $this->dispatch(new CreateContact($request)); - return $this->response->created(route('api.contacts.show', $contact->id)); + return $this->response->created(route('api.contacts.show', $contact->id), $this->item($contact, new Transformer())); } /** diff --git a/app/Http/Controllers/Api/Common/Dashboards.php b/app/Http/Controllers/Api/Common/Dashboards.php index 4a50ec90f..0dba14271 100644 --- a/app/Http/Controllers/Api/Common/Dashboards.php +++ b/app/Http/Controllers/Api/Common/Dashboards.php @@ -42,7 +42,7 @@ class Dashboards extends ApiController // Check if user can access dashboard $this->canAccess($dashboard); - return $this->response->item($dashboard, new Transformer()); + return $this->item($dashboard, new Transformer()); } catch (\Exception $e) { $this->response->errorUnauthorized($e->getMessage()); } @@ -58,7 +58,7 @@ class Dashboards extends ApiController { $dashboard = $this->dispatch(new CreateDashboard($request)); - return $this->response->created(route('api.dashboards.show', $dashboard->id)); + return $this->response->created(route('api.dashboards.show', $dashboard->id), $this->item($dashboard, new Transformer())); } /** diff --git a/app/Http/Controllers/Api/Common/Items.php b/app/Http/Controllers/Api/Common/Items.php index 5910ac2b1..bbe05a16a 100644 --- a/app/Http/Controllers/Api/Common/Items.php +++ b/app/Http/Controllers/Api/Common/Items.php @@ -34,7 +34,7 @@ class Items extends ApiController { $item = Item::with('category', 'taxes')->find($id); - return $this->response->item($item, new Transformer()); + return $this->item($item, new Transformer()); } /** @@ -47,7 +47,7 @@ class Items extends ApiController { $item = $this->dispatch(new CreateItem($request)); - return $this->response->created(route('api.items.show', $item->id)); + return $this->response->created(route('api.items.show', $item->id), $this->item($item, new Transformer())); } /** diff --git a/app/Http/Controllers/Api/Common/Reports.php b/app/Http/Controllers/Api/Common/Reports.php index 162529be3..0a402e90b 100644 --- a/app/Http/Controllers/Api/Common/Reports.php +++ b/app/Http/Controllers/Api/Common/Reports.php @@ -32,7 +32,7 @@ class Reports extends ApiController */ public function show(Report $report) { - return $this->response->item($report, new Transformer()); + return $this->item($report, new Transformer()); } /** @@ -45,7 +45,7 @@ class Reports extends ApiController { $report = $this->dispatch(new CreateReport($request)); - return $this->response->created(route('api.reports.show', $report->id)); + return $this->response->created(route('api.reports.show', $report->id), $this->item($report, new Transformer())); } /** diff --git a/app/Http/Controllers/Api/Document/DocumentTransactions.php b/app/Http/Controllers/Api/Document/DocumentTransactions.php index 9ed91490a..59f61f372 100644 --- a/app/Http/Controllers/Api/Document/DocumentTransactions.php +++ b/app/Http/Controllers/Api/Document/DocumentTransactions.php @@ -48,7 +48,7 @@ class DocumentTransactions extends ApiController { $transaction = Transaction::documentId($document_id)->find($id); - return $this->response->item($transaction, new Transformer()); + return $this->item($transaction, new Transformer()); } /** @@ -64,7 +64,7 @@ class DocumentTransactions extends ApiController $transaction = $this->dispatch(new CreateBankingDocumentTransaction($document, $request)); - return $this->response->created(route('api.documents.transactions.show', [$document_id, $transaction->id])); + return $this->response->created(route('api.documents.transactions.show', [$document_id, $transaction->id]), $this->item($transaction, new Transformer())); } /** diff --git a/app/Http/Controllers/Api/Document/Documents.php b/app/Http/Controllers/Api/Document/Documents.php index f77fcdd5e..032934af8 100644 --- a/app/Http/Controllers/Api/Document/Documents.php +++ b/app/Http/Controllers/Api/Document/Documents.php @@ -39,7 +39,7 @@ class Documents extends ApiController $document = Document::where('document_number', $id)->first(); } - return $this->response->item($document, new Transformer()); + return $this->item($document, new Transformer()); } /** @@ -53,7 +53,7 @@ class Documents extends ApiController { $document = $this->dispatch(new CreateDocument($request)); - return $this->response->created(route('api.documents.show', $document->id)); + return $this->response->created(route('api.documents.show', $document->id), $this->item($document, new Transformer())); } /** @@ -68,7 +68,7 @@ class Documents extends ApiController { $document = $this->dispatch(new UpdateDocument($document, $request)); - return $this->response->item($document->fresh(), new Transformer()); + return $this->item($document->fresh(), new Transformer()); } /** diff --git a/app/Http/Controllers/Api/Settings/Categories.php b/app/Http/Controllers/Api/Settings/Categories.php index 5fb18c698..35fe3b831 100644 --- a/app/Http/Controllers/Api/Settings/Categories.php +++ b/app/Http/Controllers/Api/Settings/Categories.php @@ -32,7 +32,7 @@ class Categories extends ApiController */ public function show(Category $category) { - return $this->response->item($category, new Transformer()); + return $this->item($category, new Transformer()); } /** @@ -45,7 +45,7 @@ class Categories extends ApiController { $category = $this->dispatch(new CreateCategory($request)); - return $this->response->created(route('api.categories.show', $category->id)); + return $this->response->created(route('api.categories.show', $category->id), $this->item($category, new Transformer())); } /** diff --git a/app/Http/Controllers/Api/Settings/Currencies.php b/app/Http/Controllers/Api/Settings/Currencies.php index e867d9838..f518074c9 100644 --- a/app/Http/Controllers/Api/Settings/Currencies.php +++ b/app/Http/Controllers/Api/Settings/Currencies.php @@ -39,7 +39,7 @@ class Currencies extends ApiController $currency = Currency::where('code', $id)->first(); } - return $this->response->item($currency, new Transformer()); + return $this->item($currency, new Transformer()); } /** @@ -52,7 +52,7 @@ class Currencies extends ApiController { $currency = $this->dispatch(new CreateCurrency($request)); - return $this->response->created(route('api.currencies.show', $currency->id)); + return $this->response->created(route('api.currencies.show', $currency->id), $this->item($currency, new Transformer())); } /** diff --git a/app/Http/Controllers/Api/Settings/Settings.php b/app/Http/Controllers/Api/Settings/Settings.php index 6454bbb46..ebaa7f0a6 100644 --- a/app/Http/Controllers/Api/Settings/Settings.php +++ b/app/Http/Controllers/Api/Settings/Settings.php @@ -39,7 +39,7 @@ class Settings extends ApiController $setting = Setting::where('key', $id)->first(); } - return $this->response->item($setting, new Transformer()); + return $this->item($setting, new Transformer()); } /** @@ -52,7 +52,7 @@ class Settings extends ApiController { $setting = Setting::create($request->all()); - return $this->response->created(route('api.settings.show', $setting->id)); + return $this->response->created(route('api.settings.show', $setting->id), $this->item($setting, new Transformer())); } /** @@ -66,7 +66,7 @@ class Settings extends ApiController { $setting->update($request->all()); - return $this->response->item($setting->fresh(), new Transformer()); + return $this->item($setting->fresh(), new Transformer()); } /** diff --git a/app/Http/Controllers/Api/Settings/Taxes.php b/app/Http/Controllers/Api/Settings/Taxes.php index fcbba72b7..279768643 100644 --- a/app/Http/Controllers/Api/Settings/Taxes.php +++ b/app/Http/Controllers/Api/Settings/Taxes.php @@ -32,7 +32,7 @@ class Taxes extends ApiController */ public function show(Tax $tax) { - return $this->response->item($tax, new Transformer()); + return $this->item($tax, new Transformer()); } /** @@ -45,7 +45,7 @@ class Taxes extends ApiController { $tax = $this->dispatch(new CreateTax($request)); - return $this->response->created(route('api.taxes.show', $tax->id)); + return $this->response->created(route('api.taxes.show', $tax->id), $this->item($tax, new Transformer())); } /**