Browse Source

update search

pull/3/head
ibnu 1 year ago
parent
commit
4cd909c8ed
  1. 17
      app/Http/Controllers/ProjectController.php

17
app/Http/Controllers/ProjectController.php

@ -216,22 +216,9 @@ class ProjectController extends Controller
return response()->json(['status'=>'success','code'=>200,'data'=>$dataGet, 'totalRecord'=>$totalRecord], 200);
}
public function searchCustom(Request $request)
{
$payload = $request->all();
$dataBuilder = $this->setUpPayloadSelect($payload, 'm_proyek');
$builder = $dataBuilder['builder'];
$countBuilder = $dataBuilder['count'];
$dataGet = $builder->get();
$totalRecord = $countBuilder->count();
return response()->json(['status'=>'success','code'=>200,'data'=>$dataGet, 'totalRecord'=>$totalRecord], 200);
}
public function list()
{
$data = Project::orderBy('id', 'desc')->get();
$data = Project::select("id", "nama", "kode_sortname")->orderBy('id', 'desc')->get();
$countData = $data->count();
if(!$data)
@ -254,7 +241,7 @@ class ProjectController extends Controller
}
try {
$projectsByType = DB::table('m_proyek')
->select('m_type_proyek.name', DB::raw('count(*) as total'))
->select('m_type_proyek.name', DB::raw('count(id) as total'))
->join('m_type_proyek', 'm_type_proyek.id', '=', 'm_proyek.type_proyek_id')
->groupBy('m_type_proyek.name')
->get();

Loading…
Cancel
Save