table; $data['db_key'] = $this->primaryKey; $data['route'] = $route; $dtable = \DB::select("SELECT * from groups_admin order by id desc"); // LIST DATA TABLE $data['data_table'] = $dtable; $cGlobal = new Controller(); // FORM FIELD FOR STORE $data['set_field'] = [ 'name' => $cGlobal->cleanString($request->post('description')), 'description' => $request->post('description'), 'is_active' => $request->post('is_active') ]; // GET DATA FOR EDIT if ($request->post('id')) { $data['get_data_edit'] = collect(\DB::select("SELECT * FROM groups_admin where id = ?",[$request->post('id')]))->first(); } foreach($data['tableHead'] as $v){ $arrHead[] = $v[2]; } $data['head'] = implode(",",$arrHead); return $data; } public function getDT($data,$init) { $dt = DT::of($data); $dt->editColumn('is_active',function($data) { return ($data->is_active == true) ? 'Active':'Non-Active'; }); return $dt; } }