当前位置: 首页>>代码示例>>PHP>>正文


PHP Department::where方法代码示例

本文整理汇总了PHP中app\Department::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Department::where方法的具体用法?PHP Department::where怎么用?PHP Department::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\Department的用法示例。


在下文中一共展示了Department::where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: departmentView

 public function departmentView($department_code, $filter)
 {
     $ticketFilter = new TicketFilter($department_code, $filter);
     $tickets = $ticketFilter->departmentViewFilter();
     $department = \App\Department::where('department_code', $department_code)->first();
     return view('helpdeskviews.department', compact('department', 'tickets', 'filter'));
 }
开发者ID:knieber,项目名称:SBTShelpdesk,代码行数:7,代码来源:HelpDeskController.php

示例2: search

 public function search(Request $request)
 {
     $results = array();
     $term = $request->get('term');
     $goals = Goal::where('body', 'like', '%' . $term . '%')->orderBy('body', 'asc')->get();
     $objectives = Objective::where('body', 'like', '%' . $term . '%')->orderBy('body', 'asc')->get();
     $actions = Action::where('body', 'like', '%' . $term . '%')->orderBy('body', 'asc')->get();
     $tasks = Task::where('body', 'like', '%' . $term . '%')->orderBy('body', 'asc')->get();
     $teams = Team::where('name', 'like', '%' . $term . '%')->orderBy('name', 'asc')->get();
     $departments = Department::where('name', 'like', '%' . $term . '%')->orderBy('name', 'asc')->get();
     $users = User::where('name', 'like', '%' . $term . '%')->orderBy('name', 'asc')->get()->all();
     foreach (User::where('email', 'like', '%' . $term . '%')->orderBy('name', 'asc')->get() as $matching_user_email) {
         if (in_array($matching_user_email, $users)) {
             continue;
         }
         $users[] = $matching_user_email;
     }
     $notes = Note::where('content', 'like', '%' . $term . '%')->orderBy('content', 'asc')->get();
     $types = [$goals, $objectives, $actions, $tasks, $teams, $departments, $users, $notes];
     foreach ($types as $type) {
         foreach ($type as $result) {
             $results[] = $result;
         }
     }
     return view('search.show')->with('results', $results)->with('term', $term);
 }
开发者ID:macewanCS,项目名称:librasoft,代码行数:26,代码来源:SearchController.php

示例3: update

 /**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  int  $id
  * @return Response
  */
 public function update(DepartmentRequest $request)
 {
     $dept = Department::where('id', $request['deptID'])->first();
     $dept->name = $request['name'];
     $dept->save();
     \Session::flash('success', $request['name'] . ' has been successfully updated!');
     return redirect()->back();
 }
开发者ID:elieishimwe,项目名称:Siyaleader-Transnet,代码行数:15,代码来源:DepartmentController.php

示例4: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $this->data['user'] = User::where('deleted_at', null)->count();
     $this->data['user_disabled'] = User::where('deleted_at', !null)->count();
     $this->data['department'] = Department::where('enabled', 1)->count();
     $this->data['position'] = Position::where('enabled', 1)->count();
     return view('pages.admin.dashboard', $this->data);
 }
开发者ID:bilfash,项目名称:monstaff,代码行数:13,代码来源:AdminController.php

示例5: getCourse

 /**
  * @param Request $request
  * @return \Illuminate\Contracts\Routing\ResponseFactory|\Symfony\Component\HttpFoundation\Response
  */
 public function getCourse(Request $request)
 {
     if ($request->ajax()) {
         $department = Department::where('name', $request->input('name'))->first();
         $courses = $department->courses->pluck('name');
         return response($courses);
     }
 }
开发者ID:arnabrahman,项目名称:Course-and-Result-Management,代码行数:12,代码来源:ClassroomController.php

示例6: update

 /**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  int  $id
  * @return Response
  */
 public function update(DepartmentRequest $request)
 {
     $dept = Department::where('id', $request['deptID'])->first();
     $dept->name = $request['name'];
     $dept->updated_by = \Auth::user()->id;
     $dept->save();
     \Session::flash('success', 'well done! Role ' . $request['name'] . ' has been successfully added!');
     return redirect()->back();
 }
开发者ID:elieishimwe,项目名称:Siyaleader-DUT,代码行数:16,代码来源:DepartmentController.php

示例7: fuzzyQuery

 public function fuzzyQuery(Request $request)
 {
     $this->validate($request, ['keyword' => 'required|max:255']);
     $keyword = $request->get('keyword');
     $hospitals = Hospital::where('hospital_name', 'like', "%{$keyword}%")->orwhere('city', 'like', "%{$keyword}%")->orwhere('hospital_level', 'like', "%{$keyword}%")->orwhere('description', 'like', "%{$keyword}%")->get();
     $departments = Department::where('department_name', 'like', "%{$keyword}%")->orwhere('department_description', 'like', "%{$keyword}%")->get();
     $doctors = Doctor::where('doctor_name', 'like', "%{$keyword}%")->orwhere('doctor_level', 'like', "%{$keyword}%")->orwhere('doctor_description', 'like', "%{$keyword}%")->get();
     $response = ['hospitals' => $hospitals, 'department' => $departments, 'doctors' => $doctors];
     return json_encode($response);
 }
开发者ID:Beyond-Game,项目名称:Raffaello,代码行数:10,代码来源:SearchController.php

示例8: show

 /**
  * Display the specified resource.
  * @param Request $request
  * @param  int $id
  * @return \Illuminate\Http\Response
  */
 public function show(Request $request, $id)
 {
     if ($request->ajax()) {
         $department = Department::where('code', $id)->first();
         $teachers = $department->teachers->pluck('name', 'id');
         $courses = $department->courses()->whereNull('isAssigned')->orWhere('isAssigned', '')->pluck('code');
         // get the code of unassigned courses in department
         return response([$courses, $teachers]);
     }
 }
开发者ID:arnabrahman,项目名称:Course-and-Result-Management,代码行数:16,代码来源:DepartmentController.php

示例9: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request $request
  * @return \Illuminate\Http\Response
  */
 public function store(saveCourseRequest $request)
 {
     $course = new Course($request->except(['department', 'semester']));
     $department = Department::where('code', $request->input('department'))->first();
     $semester = Semester::find($request->input('semester'));
     $course->department()->associate($department);
     $course->semester()->associate($semester);
     $course->save();
     $request->session()->flash('status', 'Course was saved successful!');
     return back();
 }
开发者ID:arnabrahman,项目名称:Course-and-Result-Management,代码行数:17,代码来源:CourseController.php

示例10: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['name' => 'required|string']);
     $duplicate = Department::where('name', $request->name)->first();
     if ($duplicate) {
         return response()->json(true);
     }
     $department = new Department();
     $department->name = $request->name;
     $department->save();
 }
开发者ID:mcoyevans,项目名称:personiv-productivity-quality-report,代码行数:17,代码来源:DepartmentController.php

示例11: search

 public static function search($query)
 {
     if (empty($query)) {
         return Collection::make();
     }
     return Department::where('name', 'like', '%' . $query . '%')->orderBy('name', 'asc')->take(5)->get(array('id', 'name'))->map(function ($department) {
         $department->label = $department->name;
         $department->type = 'department';
         $department->url = route('departments.show', $department->id);
         return $department;
     });
 }
开发者ID:jeanfredrik,项目名称:staff-manager-laravel,代码行数:12,代码来源:Department.php

示例12: filter

 public function filter()
 {
     $city_id = Input::get('city');
     $departments = Department::orderBy('city_id')->get();
     if (isset($city_id)) {
         if ($city_id == 0) {
             $departments = Department::orderBy('city_id')->get();
         } else {
             $departments = Department::where('city_id', $city_id)->get();
         }
     }
     return View::make('department.all', ['category' => 1, 'departments' => $departments, 'selectedCity' => $city_id]);
 }
开发者ID:yaroslavmelnichuk,项目名称:LarkaKursova,代码行数:13,代码来源:DepartmentsController.php

示例13: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request $request
  * @return \Illuminate\Http\Response
  */
 public function store(saveTeacherRequest $request)
 {
     $request->merge(array('remaining_credit' => $request->input('assigned_credit')));
     // Set remaining credit equal to assigned credit
     $teacher = new Teacher($request->except(['department', 'designation']));
     $department = Department::where('name', $request->input('department'))->first();
     $designation = Designation::where('name', $request->input('designation'))->first();
     $teacher->department()->associate($department);
     $teacher->designation()->associate($designation);
     $teacher->save();
     $teacher_request = new UserRequestHandle('Teacher', $request->input('email'));
     $teacher_request->save();
     $request->session()->flash('status', 'Teacher was saved successful!');
     return back();
 }
开发者ID:arnabrahman,项目名称:Course-and-Result-Management,代码行数:21,代码来源:TeacherController.php

示例14: index

 public function index(Request $request)
 {
     if ($request->get('department')) {
         $services = \App\Service::filterByDepartment($request->get('department'))->get();
         $departments = \App\Department::where('id', $request->get('department'))->get();
     } elseif ($request->get('domain')) {
         $domain = \App\Domain::findOrfail($request->get('domain'));
         $services = $domain->services()->get();
         $departments = $domain->departments()->get();
     } else {
         $services = $this->services;
         $departments = \App\Department::all();
     }
     return view('services.index', ['services' => $services, 'departments' => $departments]);
 }
开发者ID:kharhys,项目名称:revenue,代码行数:15,代码来源:ServiceController.php

示例15: store

 /**
  * Store a newly created resource in storage.
  * @param RegisterStudentRequest $request
  * @return \Illuminate\Http\RedirectResponse
  */
 public function store(RegisterStudentRequest $request)
 {
     $student = new Student($request->except(['department_code']));
     $date = strtotime($request->input('current_date'));
     $student->current_date = date('d/m/Y', $date);
     // Changed string date to Date format
     $department = Department::where('code', $request->input('department_code'))->first();
     $student->registration_no = $department->name . '-' . date('Y', $date) . '-' . sprintf("%03d", $department->students->count() + 1);
     // Create Student registration no.
     $student->department()->associate($department);
     $student->save();
     $student_request = new UserRequestHandle('Student', $request->input('email'));
     $student_request->save();
     $request->session()->flash('status', 'Student registration was successful!');
     return back();
 }
开发者ID:arnabrahman,项目名称:Course-and-Result-Management,代码行数:21,代码来源:StudentController.php


注:本文中的app\Department::where方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。