public function edit(TicketDepartment $TicketDepartment, $id)
 {
     $department = $TicketDepartment::with('users')->findOrFail($id);
     $users = User::pluck('name', 'id')->toArray();
     $departments = $TicketDepartment::where('id', '!=', $id)->whereNotDescendantOf($id)->withDepth()->get();
     $options = [NULL => NULL];
     foreach ($departments as $dep) {
         $options[$dep->id] = str_repeat("----", $dep->depth) . $dep->name;
     }
     $departments = $options;
     $current_users = $department->users->pluck('id')->toArray();
     return view('tickets::departments.edit', compact('department', 'departments', 'users', 'current_users'));
 }
Example #2
0
 public function index(Request $request)
 {
     // canOne(['view.students.students', 'contact.students.students']
     // dd(Auth::user()->canOne(['notes.index.quran','elements.index.quran']));
     $users = User::select('users.*')->with('quran_subjects', 'quran_students')->join('role_user', 'users.id', '=', 'role_user.user_id')->join('roles', function ($join) {
         $join->on('role_user.role_id', '=', 'roles.id')->where('roles.name', 'LIKE', '%القرآن الكريم%');
     });
     if ($request->has('name')) {
         $users->where('users.id', $request->input('name'));
     } elseif ($request->has('mobile')) {
         $users->where('mobile', $request->input('mobile'));
     }
     $users = $users->paginate(20);
     // return ($users);
     $names = User::select('users.*')->with('quran_subjects', 'quran_students')->join('role_user', 'users.id', '=', 'role_user.user_id')->join('roles', function ($join) {
         $join->on('role_user.role_id', '=', 'roles.id')->where('roles.name', 'LIKE', '%القرآن الكريم%');
     })->pluck('name', 'id')->toArray();
     $mobiles = User::pluck('mobile', 'id')->toArray();
     return view('quran::evaluators.index', compact('users', 'names', 'mobiles'));
 }
Example #3
0
 /**
  * Show the form for editing the specified resource.
  * @return Response
  */
 public function editpaper($paper_id)
 {
     $users = User::pluck('name', 'id')->toArray();
     $paper = Paper::find($paper_id)->with('user', 'student')->first();
     return view('papers::editpaper', compact('paper', 'users'));
 }