本文整理汇总了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'));
}
示例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);
}
示例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();
}
示例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);
}
示例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);
}
}
示例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();
}
示例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);
}
示例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]);
}
}
示例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();
}
示例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();
}
示例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;
});
}
示例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]);
}
示例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();
}
示例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]);
}
示例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();
}