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