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