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