ajax()) { $data = Riwayat::select('*'); // Convert the Eloquent Collection to a regular PHP array $data->each(function ($item, $key) { $item->rowIndex = $key + 1; }); return Datatables::of($data) ->addIndexColumn() ->addColumn('title-post', function($row){ $text = '

' . $row->gejala . '

'; return $text; }) ->addColumn('jenis_gejala', function($row){ return $row->gejala; }) ->rawColumns(['title-post', 'jenis_gejala']) ->make(true); } $data = [ 'subtitle' => 'Riwayat' ]; return view('admin.app.content.riwayat.index', compact('data')); } }