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