repository = $vessel_running_sheet; $this->repository ->pushCriteria(\Litepie\Repository\Criteria\RequestCriteria::class) ->pushCriteria(\Moblyze\Logbook\Repositories\Criteria\VesselRunningSheetResourceCriteria::class); } /** * Display a list of vessel_running_sheet. * * @return Response */ public function index(VesselRunningSheetRequest $request) { return $this->repository ->setPresenter(\Moblyze\Logbook\Repositories\Presenter\VesselRunningSheetPresenter::class) ->paginate(); } /** * Display vessel_running_sheet. * * @param Request $request * @param Model $vessel_running_sheet * * @return Response */ public function show(VesselRunningSheetRequest $request, VesselRunningSheet $vessel_running_sheet) { return $vessel_running_sheet->setPresenter(\Moblyze\Logbook\Repositories\Presenter\VesselRunningSheetListPresenter::class); ; } /** * Create new vessel_running_sheet. * * @param Request $request * * @return Response */ public function store(VesselRunningSheetRequest $request) { try { $data = $request->all(); $data['user_id'] = user_id(); $data['user_type'] = user_type(); $data = $this->repository->create($data); $message = trans('messages.success.created', ['Module' => trans('logbook::vessel_running_sheet.name')]); $code = 204; $status = 'success'; $url = guard_url('logbook/vessel_running_sheet/' . $vessel_running_sheet->getRouteKey()); } catch (Exception $e) { $message = $e->getMessage(); $code = 400; $status = 'error'; $url = guard_url('logbook/vessel_running_sheet'); } return compact('data', 'message', 'code', 'status', 'url'); } /** * Update the vessel_running_sheet. * * @param Request $request * @param Model $vessel_running_sheet * * @return Response */ public function update(VesselRunningSheetRequest $request, VesselRunningSheet $vessel_running_sheet) { try { $data = $request->all(); $vessel_running_sheet->update($data); $message = trans('messages.success.updated', ['Module' => trans('logbook::vessel_running_sheet.name')]); $code = 204; $status = 'success'; $url = guard_url('logbook/vessel_running_sheet/' . $vessel_running_sheet->getRouteKey()); } catch (Exception $e) { $message = $e->getMessage(); $code = 400; $status = 'error'; $url = guard_url('logbook/vessel_running_sheet/' . $vessel_running_sheet->getRouteKey()); } return compact('data', 'message', 'code', 'status', 'url'); } /** * Remove the vessel_running_sheet. * * @param Model $vessel_running_sheet * * @return Response */ public function destroy(VesselRunningSheetRequest $request, VesselRunningSheet $vessel_running_sheet) { try { $vessel_running_sheet->delete(); $message = trans('messages.success.deleted', ['Module' => trans('logbook::vessel_running_sheet.name')]); $code = 202; $status = 'success'; $url = guard_url('logbook/vessel_running_sheet/0'); } catch (Exception $e) { $message = $e->getMessage(); $code = 400; $status = 'error'; $url = guard_url('logbook/vessel_running_sheet/' . $vessel_running_sheet->getRouteKey()); } return compact('message', 'code', 'status', 'url'); } /** * Return the form elements as json. * * @param String $element * * @return json */ public function form($element = 'fields') { $form = new Form(); return $form->form($element, true); } }