orderBy('depend_on')->get(); $data['all_user'] = User::where('active',1)->get(); $data['all_group'] = Group::where('user_id',0)->get(); return view('admin.user_group',$data); /* 1=Created; 2=in process; 3=Completed; 4=checking; 5=bugfixing; 5=done; */ } public function add_group_user(Request $req){ $type = $req->type; $group_name = $req->group_name; $group_id = $req->group_id; $user_id = $req->user_id; $designation = $req->designation; if($type == 1){ $sav = new Group; $sav->group_name = $group_name; $sav->save(); } elseif($type == 2){ $sav = new Group; $sav->user_id = $user_id; $sav->depend_on = $group_id; $sav->designation = $designation; $sav->active = 1; $sav->save(); } else{ } return redirect()->back()->with('msg','Saved successfully !'); } public function remove_group_user($id){ $del = Group::find($id)->delete(); return redirect()->back()->with('msg','Removed successfully !'); } }