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