Browse Source

fix divisi search

pull/3/head
wahyu 1 year ago
parent
commit
4859cba81e
  1. 13
      app/Http/Controllers/DivisiController.php

13
app/Http/Controllers/DivisiController.php

@ -70,9 +70,16 @@ class DivisiController extends Controller
return response()->json(['status'=>'success','message'=> 'Data deleted!','code'=> 200], 200);
}
public function search()
{
return $this->list();
public function search(Request $request)
{
$payload = $request->all();
$dataBuilder = $this->setUpPayload($payload, 'm_divisi');
$builder = $dataBuilder['builder'];
$countBuilder = $dataBuilder['count'];
$dataGet = $builder->get();
$totalRecord = $countBuilder->count();
return response()->json(['status'=>'success','code'=>200,'data'=>$dataGet, 'totalRecord'=>$totalRecord], 200);
//return $this->list();
// cant use builder for this case
}

Loading…
Cancel
Save