Advertisement
widana

Backend Controller

Jan 11th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.19 KB | None | 0 0
  1.     public function data(Request $req)
  2.     {
  3.         $total = 0;
  4.         try {
  5.  
  6.             $input['keyword'] = $req->input('src');
  7.             $input['current_status_toko'] = $req->input('current_status_toko', '');
  8.             $input['active'] = $req->input('active', '');
  9.  
  10.  
  11.             $countTokoList = App::make('countTokoList');
  12.             $dtoOutput = $countTokoList->execute($input);
  13.  
  14.             $total = $dtoOutput["total"];
  15.  
  16.         } catch(CoreException $ex) {
  17.             $total = 0;
  18.         }
  19.  
  20.  
  21.         try {
  22.  
  23.             $input['keyword'] = $req->input('src');
  24.             $input['limit'] = $req->input('limit');
  25.             $input['offset'] = $req->input('offset');
  26.             $input['current_status_toko'] = $req->input('current_status_toko', '');
  27.             $input['active'] = $req->input('active', '');
  28.             Log::debug($input);
  29.  
  30.             $getTokoList = App::make('getTokoList');
  31.             $dtoOutput = $getTokoList->execute($input);
  32.  
  33.             $response = Response::ok(["toko_list" => $dtoOutput[0], "total" => $total]);
  34.  
  35.         } catch(CoreException $ex) {
  36.             $response = Response::fail($ex);
  37.         }
  38.  
  39.         return $response;
  40.  
  41.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement