repository = $customerservicesetting; parent::__construct(); } /** * Show customerservicesetting's list. * * @param string $slug * * @return response */ protected function index() { $customerservicesettings = $this->repository ->setPresenter('\\Lavalite\\Kefu\\Repositories\\Presenter\\CustomerservicesettingListPresenter') ->scopeQuery(function($query){ return $query->orderBy('id','DESC'); })->paginate(); $customerservicesettings['code'] = 2000; return response()->json($customerservicesettings) ->setStatusCode(200, 'INDEX_SUCCESS'); } /** * Show customerservicesetting. * * @param string $slug * * @return response */ protected function show($slug) { $customerservicesetting = $this->repository ->scopeQuery(function($query) use ($slug) { return $query->orderBy('id','DESC') ->where('slug', $slug); })->first(['*']); if (!is_null($customerservicesetting)) { $customerservicesetting = $this->itemPresenter($module, new CustomerservicesettingItemTransformer); $customerservicesetting['code'] = 2001; return response()->json($customerservicesetting) ->setStatusCode(200, 'SHOW_SUCCESS'); } else { return response()->json([]) ->setStatusCode(400, 'SHOW_ERROR'); } } }