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

@ -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()));
}
/**

View File

@ -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()));
}
/**

View File

@ -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()));
}
/**

View File

@ -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()));
}
/**

View File

@ -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()));
}
/**