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