repository = $passenger_manifest; $this->repository ->pushCriteria(\Litepie\Repository\Criteria\RequestCriteria::class) ->pushCriteria(\Moblyze\Logbook\Repositories\Criteria\PassengerManifestResourceCriteria::class); } /** * Display a list of passenger_manifest. * * @return Response */ public function index(PassengerManifestRequest $request) { return $this->repository ->setPresenter(\Moblyze\Logbook\Repositories\Presenter\PassengerManifestPresenter::class) ->paginate(); } /** * Display passenger_manifest. * * @param Request $request * @param Model $passenger_manifest * * @return Response */ public function show(PassengerManifestRequest $request, PassengerManifest $passenger_manifest) { return $passenger_manifest->setPresenter(\Moblyze\Logbook\Repositories\Presenter\PassengerManifestListPresenter::class); ; } /** * Create new passenger_manifest. * * @param Request $request * * @return Response */ public function store(PassengerManifestRequest $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::passenger_manifest.name')]); $code = 204; $status = 'success'; $url = guard_url('logbook/passenger_manifest/' . $passenger_manifest->getRouteKey()); } catch (Exception $e) { $message = $e->getMessage(); $code = 400; $status = 'error'; $url = guard_url('logbook/passenger_manifest'); } return compact('data', 'message', 'code', 'status', 'url'); } /** * Update the passenger_manifest. * * @param Request $request * @param Model $passenger_manifest * * @return Response */ public function update(PassengerManifestRequest $request, PassengerManifest $passenger_manifest) { try { $data = $request->all(); $passenger_manifest->update($data); $message = trans('messages.success.updated', ['Module' => trans('logbook::passenger_manifest.name')]); $code = 204; $status = 'success'; $url = guard_url('logbook/passenger_manifest/' . $passenger_manifest->getRouteKey()); } catch (Exception $e) { $message = $e->getMessage(); $code = 400; $status = 'error'; $url = guard_url('logbook/passenger_manifest/' . $passenger_manifest->getRouteKey()); } return compact('data', 'message', 'code', 'status', 'url'); } /** * Remove the passenger_manifest. * * @param Model $passenger_manifest * * @return Response */ public function destroy(PassengerManifestRequest $request, PassengerManifest $passenger_manifest) { try { $passenger_manifest->delete(); $message = trans('messages.success.deleted', ['Module' => trans('logbook::passenger_manifest.name')]); $code = 202; $status = 'success'; $url = guard_url('logbook/passenger_manifest/0'); } catch (Exception $e) { $message = $e->getMessage(); $code = 400; $status = 'error'; $url = guard_url('logbook/passenger_manifest/' . $passenger_manifest->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); } }