repository = $lead_meeting; $this->repository ->pushCriteria(\Litepie\Repository\Criteria\RequestCriteria::class) ->pushCriteria(\Buyesrfolio\LeadMeeting\Repositories\Criteria\LeadMeetingResourceCriteria::class); } /** * Display a list of lead_meeting. * * @return Response */ public function index(LeadMeetingRequest $request) { $view = $this->response->theme->listView(); if ($this->response->typeIs('json')) { $function = camel_case('get-' . $view); return $this->repository ->setPresenter(\Buyesrfolio\LeadMeeting\Repositories\Presenter\LeadMeetingPresenter::class) ->$function(); } $lead_meetings = $this->repository->paginate(); return $this->response->setMetaTitle(trans('lead_meeting::lead_meeting.names')) ->view('lead_meeting::lead_meeting.index', true) ->data(compact('lead_meetings', 'view')) ->output(); } /** * Display lead_meeting. * * @param Request $request * @param Model $lead_meeting * * @return Response */ public function show(LeadMeetingRequest $request, LeadMeeting $lead_meeting) { if ($lead_meeting->exists) { $view = 'lead_meeting::lead_meeting.show'; } else { $view = 'lead_meeting::lead_meeting.new'; } return $this->response->setMetaTitle(trans('app.view') . ' ' . trans('lead_meeting::lead_meeting.name')) ->data(compact('lead_meeting')) ->view($view, true) ->output(); } /** * Show the form for creating a new lead_meeting. * * @param Request $request * * @return Response */ public function create(LeadMeetingRequest $request) { $lead_meeting = $this->repository->newInstance([]); return $this->response->setMetaTitle(trans('app.new') . ' ' . trans('lead_meeting::lead_meeting.name')) ->view('lead_meeting::lead_meeting.create', true) ->data(compact('lead_meeting')) ->output(); } /** * Create new lead_meeting. * * @param Request $request * * @return Response */ public function store(LeadMeetingRequest $request) { try { $attributes = $request->all(); $attributes['user_id'] = user_id(); $attributes['user_type'] = user_type(); $lead_meeting = $this->repository->create($attributes); return $this->response->message(trans('messages.success.created', ['Module' => trans('lead_meeting::lead_meeting.name')])) ->code(204) ->status('success') ->url(guard_url('lead_meeting/lead_meeting/' . $lead_meeting->getRouteKey())) ->redirect(); } catch (Exception $e) { return $this->response->message($e->getMessage()) ->code(400) ->status('error') ->url(guard_url('/lead_meeting/lead_meeting')) ->redirect(); } } /** * Show lead_meeting for editing. * * @param Request $request * @param Model $lead_meeting * * @return Response */ public function edit(LeadMeetingRequest $request, LeadMeeting $lead_meeting) { return $this->response->setMetaTitle(trans('app.edit') . ' ' . trans('lead_meeting::lead_meeting.name')) ->view('lead_meeting::lead_meeting.edit', true) ->data(compact('lead_meeting')) ->output(); } /** * Update the lead_meeting. * * @param Request $request * @param Model $lead_meeting * * @return Response */ public function update(LeadMeetingRequest $request, LeadMeeting $lead_meeting) { try { $attributes = $request->all(); $lead_meeting->update($attributes); return $this->response->message(trans('messages.success.updated', ['Module' => trans('lead_meeting::lead_meeting.name')])) ->code(204) ->status('success') ->url(guard_url('lead_meeting/lead_meeting/' . $lead_meeting->getRouteKey())) ->redirect(); } catch (Exception $e) { return $this->response->message($e->getMessage()) ->code(400) ->status('error') ->url(guard_url('lead_meeting/lead_meeting/' . $lead_meeting->getRouteKey())) ->redirect(); } } /** * Remove the lead_meeting. * * @param Model $lead_meeting * * @return Response */ public function destroy(LeadMeetingRequest $request, LeadMeeting $lead_meeting) { try { $lead_meeting->delete(); return $this->response->message(trans('messages.success.deleted', ['Module' => trans('lead_meeting::lead_meeting.name')])) ->code(202) ->status('success') ->url(guard_url('lead_meeting/lead_meeting/0')) ->redirect(); } catch (Exception $e) { return $this->response->message($e->getMessage()) ->code(400) ->status('error') ->url(guard_url('lead_meeting/lead_meeting/' . $lead_meeting->getRouteKey())) ->redirect(); } } /** * Remove multiple lead_meeting. * * @param Model $lead_meeting * * @return Response */ public function delete(LeadMeetingRequest $request, $type) { try { $ids = hashids_decode($request->input('ids')); if ($type == 'purge') { $this->repository->purge($ids); } else { $this->repository->delete($ids); } return $this->response->message(trans('messages.success.deleted', ['Module' => trans('lead_meeting::lead_meeting.name')])) ->status("success") ->code(202) ->url(guard_url('lead_meeting/lead_meeting')) ->redirect(); } catch (Exception $e) { return $this->response->message($e->getMessage()) ->status("error") ->code(400) ->url(guard_url('/lead_meeting/lead_meeting')) ->redirect(); } } /** * Restore deleted lead_meetings. * * @param Model $lead_meeting * * @return Response */ public function restore(LeadMeetingRequest $request) { try { $ids = hashids_decode($request->input('ids')); $this->repository->restore($ids); return $this->response->message(trans('messages.success.restore', ['Module' => trans('lead_meeting::lead_meeting.name')])) ->status("success") ->code(202) ->url(guard_url('/lead_meeting/lead_meeting')) ->redirect(); } catch (Exception $e) { return $this->response->message($e->getMessage()) ->status("error") ->code(400) ->url(guard_url('/lead_meeting/lead_meeting/')) ->redirect(); } } }