本文整理汇总了PHP中Employee::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Employee::where方法的具体用法?PHP Employee::where怎么用?PHP Employee::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Employee
的用法示例。
在下文中一共展示了Employee::where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: absentEveryEmployee
public static function absentEveryEmployee()
{
$employees = Employee::where('status', '=', 'active')->get();
$absentess = [];
foreach ($employees as $employee) {
//Count the absent except half days
foreach (Leavetype::where('leaveType', '<>', 'half day')->get() as $leave) {
//$absentess[$employee->employeeID][$leave->leaveType] = 0;
// Half Day leaves are added to casual leaves.2 half days are equal to one Casual Leave
$absentess[$employee->employeeID][$leave->leaveType] = Attendance::where('status', '=', 'absent')->where('employeeID', '=', $employee->employeeID)->where(function ($query) {
$query->where('application_status', '=', 'approved')->orWhere('application_status', '=', null);
})->where('leaveType', '=', $leave->leaveType)->count();
}
// half days count
foreach (Leavetype::where('leaveType', '=', 'half day')->get() as $leave) {
$half_day = Attendance::select('halfDayType', DB::raw('count(*) as total'))->where('status', '=', 'absent')->where('employeeID', '=', $employee->employeeID)->where(function ($query) {
$query->where('application_status', '=', 'approved')->orWhere('application_status', '=', null);
})->where('leaveType', '=', $leave->leaveType)->groupBy('halfDayType')->get();
foreach ($half_day as $half) {
$absentess[$employee->employeeID][$half->halfDayType] += $half->total / 2;
}
}
// Total of All leaves
$absentess[$employee->employeeID]['total'] = array_sum($absentess[$employee->employeeID]);
}
return $absentess;
}
示例2: edit
public function edit($id)
{
$returnment = Returnment::with('employee')->find($id);
$employees = Employee::where('location_id', '=', Auth::user()->location_id)->get();
$menu = 'finance';
return View::make('returnments.edit', compact('returnment', 'employees', 'menu'));
}
示例3: index
public function index()
{
$retrievals = Retrieval::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->get();
$employees = Employee::where('location_id', '=', Auth::user()->location_id)->get();
$menu = 'student';
return View::make('retrievals.index', compact('retrievals', 'employees', 'menu'));
}
示例4: store
public function store()
{
$validator = Validator::make($data = Input::all(), Employee::$rules);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
}
/* Employee */
if (Input::has('createEmployee')) {
Employee::create($data);
}
$message = "登録しました。";
if (Input::has('deleteEmployee')) {
$e = Employee::where('name', Input::get('name'))->first();
Employee::destroy($e->id);
$message = "削除しました。";
if (Input::has('selectedEmployee')) {
Input::replace(array('selectedEmployee', ''));
}
}
if (Input::has('updateEmployee')) {
$validator_for_update = Validator::make($data = Input::all(), Employee::$update_rules);
if ($validator_for_update->fails()) {
return Redirect::back()->withErrors($validator_for_update)->withInput();
}
$e = Employee::where('name', Input::get('name'))->first();
Employee::destroy($e->id);
$data['name'] = $data['new_name'];
Employee::create($data);
$message = "更新しました。";
}
return Redirect::route('employees.index')->with('message', $message);
}
示例5: create
public function create($course_id)
{
$course = Course::with('placements')->find($course_id);
$employees = Employee::where('teach_salary', '>', 0.0)->get();
$hours = Hour::all();
$menu = 'academic';
return View::make('presences.create', compact('course', 'subjects', 'employees', 'hours', 'menu'));
}
示例6: employees
public function employees($members)
{
$employee = json_decode($members);
foreach ($employee as $key) {
$employ[] = Employee::where('employee_identity', $key)->first()->name;
}
return $employ;
}
示例7: edit
public function edit($id)
{
$quiz = Quiz::find($id);
$subjects = Subject::all();
$employees = Employee::where('teach_salary', '>', 0.0)->get();
$menu = 'academic';
return View::make('quizzes.edit', compact('quiz', 'subjects', 'employees', 'menu'));
}
示例8: edit
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return Response
*/
public function edit($id)
{
$doctors = Employee::where('role', 'Doctor')->where('status', 'active')->get();
$patients = Patient::all();
$opt = Opt::find($id);
$timeslot = $opt->timeslot->first()->where('dutyday_id', $opt->timeslot->dutyday_id)->lists('slot', 'id');
return View::make('opt.edit', compact('timeslot', 'opt', 'doctors', 'patients'));
}
示例9: create
public function create()
{
$courses = Course::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->get();
$employees = Employee::where('location_id', '=', Auth::user()->location_id)->get();
$classifications = Classification::where('category', '=', 'Resign')->get();
$menu = 'student';
return View::make('resigns.create', compact('courses', 'classifications', 'employees', 'menu'));
}
示例10: create
/**
* Show the form for creating a new prescription
*
* @return Response
*/
public function create()
{
$appointment = Appointment::find(Input::get('id'));
$patient_id = $appointment->patient->id;
$doctors = Employee::where('role', 'Doctor')->where('status', 'Active')->get();
$medicines = Medicine::all()->lists('name', 'id');
return View::make('prescriptions.create', compact('medicines', 'appointment', 'patient_id', 'doctors'));
}
示例11: update
public function update()
{
$param = Input::all();
$emp_id = Employee::where('ssn', '=', $param['ssn'])->pluck('id');
$user = Account::find($param['id']);
$res = $user->edit(array('username' => $param['username'], 'password' => $param['password'], 'emp' => $emp_id, 'role' => $param['role']));
return Response::json(array('valid' => $res));
}
示例12: filter
public function filter($month, $year)
{
$curr_month = $month;
$curr_year = $year;
$installments = Installment::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where(DB::raw('year(schedule)'), '=', $curr_year)->where(DB::raw('month(schedule)'), '=', $curr_month)->get();
$employees = Employee::where('location_id', '=', Auth::user()->location_id)->get();
$menu = 'finance';
return View::make('installments.index', compact('installments', 'employees', 'curr_year', 'curr_month', 'menu'));
}
示例13: edit
public function edit($id)
{
$teach = Teach::find($id);
$employees = Employee::where('teach_salary', '>', 0.0)->get();
$subjects = Subject::all();
$hours = Hour::all();
$menu = 'employee';
return View::make('teaches.edit', compact('teach', 'employees', 'subjects', 'hours', 'menu'));
}
示例14: create
public function create($issue_id)
{
$issue = Issue::find($issue_id);
$receivable = Receivable::with('installments')->where('issue_id', '=', $issue_id)->first();
$registration = Registration::where('student_id', '=', $issue->student_id)->where('cost_is_paid', '=', 0)->first();
$movements = Movement::where('issue_id', '=', $issue_id)->where('paid', '=', 0)->get();
$punishments = Punishment::where('issue_id', '=', $issue_id)->where('paid', '=', 0)->get();
$resigns = Resign::where('issue_id', '=', $issue_id)->where('fines', '>', 0.0)->where('is_earned', '=', 0)->get();
$employees = Employee::where('location_id', '=', Auth::user()->location_id)->get();
$menu = 'finance';
return View::make('earnings.create', compact('issue', 'receivable', 'registration', 'movements', 'punishments', 'resigns', 'employees', 'menu'));
}
示例15: downloadTable
public function downloadTable($id, $year, $month)
{
$contents = "DATA ABSENSI BINA BAKTI\n\n";
$department = Department::find($id);
$contents .= "Unit: ," . $department->name . "\n";
$months = MyDate::get_month_names();
$contents .= "Bulan: ," . $months[$month - 1] . "\n";
$contents .= "Tahun: ," . $year . "\n\n";
$contents .= "KODE,NAMA,NORMAL,,PULANG AWAL,,,TERLAMBAT,LUPA,TUGAS LUAR,,OTHER,TIDAK MASUK,,,JUMLAH HARI MASUK,,JUMLAH HARI TIDAK MASUK,NOMINAL UANG KONSUMSI\n";
$contents .= ",,WEEKDAY,WEEKEND,WEEKDAY < 12,WEEKDAY >= 12,WEEKEND,,,WEEKDAY,WEEKEND,,SAKIT,IZIN,ALPHA,WEEKDAY,WEEKEND,,WEEKDAY,WEEKEND,PULANG AWAL,TOTAL\n";
$employees = Employee::where('department_id', '=', $id)->orderBy('name')->get();
$total = 0;
foreach ($employees as $employee) {
$contents .= $employee->ssn . ",";
$contents .= $employee->name . ",";
$data = Session::pull($employee->id, 'default');
$total += $data['konsumsi_total'];
$contents .= $data['normal_weekday'] . ",";
$contents .= $data['normal_weekend'] . ",";
$contents .= $data['pulang_awal_weekday_before_12'] . ",";
$contents .= $data['pulang_awal_weekday'] . ",";
$contents .= $data['pulang_awal_weekend'] . ",";
$contents .= $data['terlambat'] . ",";
$contents .= $data['lupa'] . ",";
$contents .= $data['tugas_luar_weekday'] . ",";
$contents .= $data['tugas_luar_weekend'] . ",";
$contents .= $data['other'] . ",";
$contents .= $data['sakit'] . ",";
$contents .= $data['izin'] . ",";
$contents .= $data['alpha'] . ",";
$contents .= $data['masuk_weekday'] . ",";
$contents .= $data['masuk_weekend'] . ",";
$contents .= $data['tidak_masuk'] . ",";
$contents .= $data['konsumsi_weekday'] . ",";
$contents .= $data['konsumsi_weekend'] . ",";
$contents .= $data['konsumsi_pulang_awal'] . ",";
$contents .= $data['konsumsi_total'] . ",";
$contents .= "\n";
}
$contents .= ",,,,,,,,,,,,,,,,,,,,," . $total;
// $file_name = "allowance.csv";
$file = public_path() . "/download/allowance.csv";
File::put($file, $contents);
return Response::download($file, "allowance-" . strtolower($department->name) . "-" . $month . "-" . $year . ".csv", array('Content-Type' => 'text/csv', 'Content-Disposition' => 'attachment;'));
}