Skip to content

Commit

Permalink
Improved repository
Browse files Browse the repository at this point in the history
  • Loading branch information
libern committed Aug 20, 2019
1 parent da084ff commit 9997509
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Someline/Repository/Controllers/BaseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,22 @@ public function show(Request $request, $id)
public function store(Request $request)
{
$data = $request->all();
$data = $this->handleData($request, $data);
return $this->repository->save($data)->present();
}

public function update(Request $request, $id)
{
$data = $request->all();
$data = $this->handleData($request, $data, $id);
return $this->repository->update($id, $data)->present();
}

protected function handleData(Request $request, $data, $id = null): array
{
return $data;
}

public function destroy(Request $request, $id)
{
return $this->repository->destroy($id)->present();
Expand Down

0 comments on commit 9997509

Please sign in to comment.