checkRoleAccess($type); if ($checkRole == false) { return view('errors.404'); } switch ($type) { case 'audit_trail': $view = 'content.management_content.audit_trail.index'; $dataPage['title'] = 'List Audit Trail'; $dataPage['tableHead'] = array( ["Role User","all","role_name"], ["Username","all","name"], ["Event","all","event"], ["Data","all","auditable_type"], ["Tanggal","all","created_at"] ); break; case 'home': $view = 'content.management_content.home.index'; $dataPage['title'] = 'Master Home'; // $dataPage['mst_home'] = \DB::select("SELECT * from mst_home"); // $dataPage['ref_katalog'] = \DB::select("SELECT * FROM ref_catalog WHERE is_active = 't'"); break; } if ($type != 'home') { foreach($dataPage['tableHead'] as $v){ $arrHead[] = $v[2]; } $dataPage['head'] = implode(",",$arrHead); } $dataPage['type'] = $type; // $dataPage['tahun'] = \DB::select("SELECT distinct on (periode_year) periode_year from master_audit_plan order by periode_year desc"); $dataPage['ref_user'] = \DB::select("SELECT * from users_admin where status_user = 't' and role = 2 order by id desc"); $dataPage['table'] = route('management_content.data_table',$type); return $this->bsGetView($view,$dataPage); } public function data_table(Request $request, $type) { $checkRole = $this->checkRoleAccess($type); if ($checkRole == false) { return view('errors.404'); } switch ($type) { case 'audit_trail': $data = \DB::select("SELECT audits.id,rru.description as role_name, bu.username as name,bu.email,audits.event,audits.auditable_type,audits.created_at FROM audits left join users_admin bu on bu.id = audits.user_id left join groups_admin rru on rru.id = bu.role order by audits.created_at desc"); break; } return DataTables::of($data) ->editColumn('created_at',function($data) use ($type) { if($type == 'audit_trail'){ return date('d-m-Y H:i:s',strtotime($data->created_at)); } }) ->addColumn('action', function ($data) use ($type) { $btn = ''; return '
'; }) ->rawColumns(['group_kka','status', 'action']) ->make(true); } public function act_any(Request $request, $type) { $checkRole = $this->checkRoleAccess($type); if ($checkRole == false) { return view('errors.404'); } switch ($type) { // HOME } } }