Changed api show and store method..

This commit is contained in:
Cüneyt Şentürk 2021-05-30 02:43:12 +03:00
parent 78016a1a94
commit dd9a10febd
18 changed files with 38 additions and 38 deletions

View File

@ -32,7 +32,7 @@ class Permissions extends ApiController
*/ */
public function show(Permission $permission) 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)); $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()));
} }
/** /**

View File

@ -32,7 +32,7 @@ class Roles extends ApiController
*/ */
public function show(Role $role) 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)); $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()));
} }
/** /**

View File

@ -39,7 +39,7 @@ class Users extends ApiController
$user = User::with('companies', 'permissions', 'roles')->where('email', $id)->first(); $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)); $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()));
} }
/** /**

View File

@ -39,7 +39,7 @@ class Accounts extends ApiController
$account = Account::where('number', $id)->first(); $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)); $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()));
} }
/** /**

View File

@ -32,7 +32,7 @@ class Reconciliations extends ApiController
*/ */
public function show(Reconciliation $reconciliation) 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)); $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()));
} }
/** /**

View File

@ -32,7 +32,7 @@ class Transactions extends ApiController
*/ */
public function show(Transaction $transaction) 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)); $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()));
} }
/** /**

View File

@ -62,7 +62,7 @@ class Transfers extends ApiController
*/ */
public function show(Transfer $transfer) 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)); $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()));
} }
/** /**

View File

@ -40,7 +40,7 @@ class Companies extends ApiController
// Check if user can access company // Check if user can access company
$this->canAccess($company); $this->canAccess($company);
return $this->response->item($company, new Transformer()); return $this->item($company, new Transformer());
} catch (\Exception $e) { } catch (\Exception $e) {
$this->response->errorUnauthorized($e->getMessage()); $this->response->errorUnauthorized($e->getMessage());
} }
@ -56,7 +56,7 @@ class Companies extends ApiController
{ {
$company = $this->dispatch(new CreateCompany($request)); $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()));
} }
/** /**

View File

@ -42,7 +42,7 @@ class Contacts extends ApiController
$contact = Contact::where('email', $id)->first(); $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)); $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()));
} }
/** /**

View File

@ -42,7 +42,7 @@ class Dashboards extends ApiController
// Check if user can access dashboard // Check if user can access dashboard
$this->canAccess($dashboard); $this->canAccess($dashboard);
return $this->response->item($dashboard, new Transformer()); return $this->item($dashboard, new Transformer());
} catch (\Exception $e) { } catch (\Exception $e) {
$this->response->errorUnauthorized($e->getMessage()); $this->response->errorUnauthorized($e->getMessage());
} }
@ -58,7 +58,7 @@ class Dashboards extends ApiController
{ {
$dashboard = $this->dispatch(new CreateDashboard($request)); $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()));
} }
/** /**

View File

@ -34,7 +34,7 @@ class Items extends ApiController
{ {
$item = Item::with('category', 'taxes')->find($id); $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)); $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()));
} }
/** /**

View File

@ -32,7 +32,7 @@ class Reports extends ApiController
*/ */
public function show(Report $report) 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)); $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()));
} }
/** /**

View File

@ -48,7 +48,7 @@ class DocumentTransactions extends ApiController
{ {
$transaction = Transaction::documentId($document_id)->find($id); $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)); $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()));
} }
/** /**

View File

@ -39,7 +39,7 @@ class Documents extends ApiController
$document = Document::where('document_number', $id)->first(); $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)); $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)); $document = $this->dispatch(new UpdateDocument($document, $request));
return $this->response->item($document->fresh(), new Transformer()); return $this->item($document->fresh(), new Transformer());
} }
/** /**

View File

@ -32,7 +32,7 @@ class Categories extends ApiController
*/ */
public function show(Category $category) 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)); $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()));
} }
/** /**

View File

@ -39,7 +39,7 @@ class Currencies extends ApiController
$currency = Currency::where('code', $id)->first(); $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)); $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()));
} }
/** /**

View File

@ -39,7 +39,7 @@ class Settings extends ApiController
$setting = Setting::where('key', $id)->first(); $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()); $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()); $setting->update($request->all());
return $this->response->item($setting->fresh(), new Transformer()); return $this->item($setting->fresh(), new Transformer());
} }
/** /**

View File

@ -32,7 +32,7 @@ class Taxes extends ApiController
*/ */
public function show(Tax $tax) 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)); $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()));
} }
/** /**