'id', ); $level = Auth::user()->level; if (strtoupper($level) == 'SUPERADMIN' || strtoupper($level) == 'GENERAL MANAGER' || strtoupper($level) == 'FINANCE MANAGER' || strtoupper($level) == 'SUPPLY CHAIN MANAGER' || strtoupper($level) == 'MARKETING MANAGER' || strtoupper($level) == 'PROJECT MANAGER') { $totalData = Project::count(); $totalFiltered = $totalData; $limit = $request->input('length'); $start = $request->input('start'); $order = $columns[$request->input('order.0.column')]; $dir = $request->input('order.0.dir'); if (empty($request->input('search.value'))) { $projects = Project::offset($start) ->limit($limit) ->orderBy($order, $dir) ->get(); }else{ $search = $request->input('search.value'); $projects = Project::where('projects.name', 'LIKE', "%{$search}%") ->offset($start) ->limit($limit) ->orderBy($order, $dir) ->get(); $totalFiltered = Project::where('projects.name', 'LIKE', "%{$search}%") ->count(); } } else { $totalData = Project::where('id_user', Auth::user()->id)->count(); $totalFiltered = $totalData; $limit = $request->input('length'); $start = $request->input('start'); $order = $columns[$request->input('order.0.column')]; $dir = $request->input('order.0.dir'); if (empty($request->input('search.value'))) { $projects = Project::where('id_user', Auth::user()->id) ->offset($start) ->limit($limit) ->orderBy($order, $dir) ->get(); }else{ $search = $request->input('search.value'); $projects = Project::where([['projects.name', 'LIKE', "%{$search}%"], ['id_user', Auth::user()->id]]) ->offset($start) ->limit($limit) ->orderBy($order, $dir) ->get(); $totalFiltered = Project::where([['projects.name', 'LIKE', "%{$search}%"],['id_user', Auth::user()->id]]) ->count(); } } $data = array(); if (!empty($projects)) { foreach ($projects as $row) { $nestedData['project'] = $row->name; if($row->id_user == NULL) { $nestedData['created_by'] = ''; } else { $nestedData['created_by'] = $row->user->fullname; } $nestedData['opsi'] = "