1according to this sample:
2
3
4 public function store(ServiceStoreRequest $request, int $id)
5 {
6 $service = new Serviceable();
7 $service->package_id = $id;
8 $service->fill($request->all());
9 try {
10 $service->save();
11 } catch (\Exception $exception) {
12 return response(array(
13 "code"=> 409,
14 "error"=>"duplicate " . $exception->getMessage()));
15 }
16 return response($service);
17 }