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