本文整理汇总了PHP中Employee::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Employee::find方法的具体用法?PHP Employee::find怎么用?PHP Employee::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Employee
的用法示例。
在下文中一共展示了Employee::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: indexAction
public function indexAction()
{
$departments = Department::find();
$this->view->departments = $departments;
$employees = Employee::find();
$this->view->employees = $employees;
}
示例2: payslip
public function payslip()
{
if (!empty(Input::get('sel'))) {
$period = Input::get("period");
$id = Input::get('employeeid');
$employees = Employee::all();
foreach ($employees as $employee) {
$transacts = DB::table('transact')->join('employee', 'transact.employee_id', '=', 'employee.personal_file_number')->where('financial_month_year', '=', Input::get('period'))->where('employee.id', '=', $employee->id)->groupBy('transact.id')->get();
$allws = DB::table('transact_allowances')->join('employee', 'transact_allowances.employee_id', '=', 'employee.id')->where('financial_month_year', '=', Input::get('period'))->where('employee.id', '=', $employee->id)->groupBy('allowance_name')->get();
$earnings = DB::table('transact_earnings')->join('employee', 'transact_earnings.employee_id', '=', 'employee.id')->where('financial_month_year', '=', Input::get('period'))->where('employee.id', '=', $employee->id)->groupBy('earning_name')->get();
$deds = DB::table('transact_deductions')->join('employee', 'transact_deductions.employee_id', '=', 'employee.id')->where('financial_month_year', '=', Input::get('period'))->where('employee.id', '=', $employee->id)->groupBy('deduction_name')->get();
$currencies = DB::table('currencies')->select('shortname')->get();
$organization = Organization::find(1);
$pdf = PDF::loadView('pdf.monthlySlip', compact('transacts', 'allws', 'deds', 'earnings', 'period', 'currencies', 'organization'))->setPaper('a4')->setOrientation('potrait');
}
return $pdf->stream('Monthly_Payslip_' . $period . '.pdf');
} else {
$period = Input::get("period");
$id = Input::get('employeeid');
$employee = Employee::find($id);
$transacts = DB::table('transact')->join('employee', 'transact.employee_id', '=', 'employee.personal_file_number')->where('financial_month_year', '=', Input::get('period'))->where('employee.id', '=', Input::get('employeeid'))->get();
$allws = DB::table('transact_allowances')->join('employee', 'transact_allowances.employee_id', '=', 'employee.id')->where('financial_month_year', '=', Input::get('period'))->where('employee.id', '=', Input::get('employeeid'))->groupBy('allowance_name')->get();
$earnings = DB::table('transact_earnings')->join('employee', 'transact_earnings.employee_id', '=', 'employee.id')->where('financial_month_year', '=', Input::get('period'))->where('employee.id', '=', Input::get('employeeid'))->groupBy('earning_name')->get();
$deds = DB::table('transact_deductions')->join('employee', 'transact_deductions.employee_id', '=', 'employee.id')->where('financial_month_year', '=', Input::get('period'))->where('employee.id', '=', Input::get('employeeid'))->groupBy('deduction_name')->get();
$currencies = DB::table('currencies')->select('shortname')->get();
$organization = Organization::find(1);
$pdf = PDF::loadView('pdf.monthlySlip', compact('employee', 'transacts', 'allws', 'deds', 'earnings', 'period', 'currencies', 'organization'))->setPaper('a4')->setOrientation('potrait');
return $pdf->stream($employee->first_name . '_' . $employee->last_name . '_' . $period . '.pdf');
}
}
示例3: checkEarnings
public function checkEarnings($id)
{
$startDate = $start = Input::get('startDate');
$endDate = $end = Input::get('endDate');
$start = date('Y-m-d', strtotime($start));
$end = date('Y-m-d', strtotime($end));
// Get the owed sum for the given range.
$salaryForRange = Employee::getSalaryRange($id, $start, $end);
$rangeSum = 0;
$rangeValetedVehicles = 0;
foreach ($salaryForRange as $item) {
$employeesCut = Vehicle::getEmployeesCut($item->vehicle_fk);
$rangeSum = $rangeSum + $employeesCut * $item->quantity;
// Calculate the number of processed vehicles.
$rangeValetedVehicles += $item->quantity;
}
$employeeData = Employee::find($id);
$processedVehicles = InvoiceElement::where('employee_fk', '=', $employeeData->id)->count();
$totalSalary = Employee::getSalary($id);
// Get the rest of the information.
$totalSum = 0;
foreach ($totalSalary as $item) {
$employeesCut = Vehicle::getEmployeesCut($item->vehicle_fk);
$totalSum = $totalSum + $employeesCut * $item->quantity;
}
return View::make('employee.profile')->with(['employeeData' => $employeeData, 'processedVehicles' => $processedVehicles, 'totalSum' => $totalSum, 'rangeSum' => $rangeSum, 'startDate' => $startDate, 'endDate' => $endDate, 'rangeValetedVehicles' => $rangeValetedVehicles]);
}
示例4: edit
public static function edit($id)
{
$employee = Employee::find($id);
$services = Service::all();
//
$serviceList = OfferedServicesController::getServices($id, $services);
View::make('employee/edit.html', array('attributes' => $employee, 'services' => $services, 'serviceList' => $serviceList));
}
示例5: get_user_logged_in
public static function get_user_logged_in()
{
if (isset($_SESSION['employee'])) {
$employee_id = $_SESSION['employee'];
$employee = Employee::find($employee_id);
return $employee;
}
return null;
}
示例6: createLeaveApplication
public static function createLeaveApplication($data)
{
$organization = Organization::getUserOrganization();
$employee = Employee::find(array_get($data, 'employee_id'));
$leavetype = Leavetype::find(array_get($data, 'leavetype_id'));
$application = new Leaveapplication();
$application->applied_start_date = array_get($data, 'applied_start_date');
$application->applied_end_date = array_get($data, 'applied_end_date');
$application->status = 'applied';
$application->application_date = date('Y-m-d');
$application->employee()->associate($employee);
$application->leavetype()->associate($leavetype);
$application->organization()->associate($organization);
$application->save();
}
示例7: sandbox
public static function sandbox()
{
$service = Service::find(1);
$services = Service::all();
$employees = Employee::all();
$employee = Employee::find(1);
$service2 = new Service(array('name' => 'aasdd', 'price' => "2", 'description' => "asfafaf"));
$errors = $service2->errors();
Kint::dump($employee);
Kint::dump($employees);
Kint::dump($service);
Kint::dump($services);
Kint::dump($errors);
// View::make('helloworld.html');
}
示例8: show
public function show($id)
{
$payroll = Payroll::findOrFail($id);
$curr_month = (int) date('m', strtotime($payroll->release_date));
$curr_year = (int) date('Y', strtotime($payroll->release_date));
$curr_month = $curr_month - 1;
if ($curr_month == 0) {
$curr_month = 12;
$curr_year = $curr_year - 1;
}
$employee = Employee::find($payroll->employee_id);
$incomes = Income::where('employee_id', '=', $employee->id)->where(DB::raw('year(release_date)'), '=', $curr_year)->where(DB::raw('month(release_date)'), '=', $curr_month)->get();
$deductions = Deduction::where('employee_id', '=', $employee->id)->where(DB::raw('year(release_date)'), '=', $curr_year)->where(DB::raw('month(release_date)'), '=', $curr_month)->get();
$teaches = Teach::where('employee_id', '=', $employee->id)->where(DB::raw('year(course_date)'), '=', $curr_year)->where(DB::raw('month(course_date)'), '=', $curr_month)->count();
$menu = 'employee';
return View::make('payrolls.show', compact('payroll', 'employee', 'incomes', 'deductions', 'teaches', 'curr_year', 'curr_month', 'menu'));
}
示例9: get_relationship
protected function get_relationship($type = null)
{
if (!$type) {
$type = $this->relationship_name;
}
switch ($type) {
case 'belongs_to':
$ret = Event::find(5);
break;
case 'has_one':
$ret = Employee::find(1);
break;
case 'has_many':
$ret = Venue::find(2);
}
return $ret;
}
示例10: generate_employees_list
private function generate_employees_list($_is_applicants = false)
{
$criteria = array('columns' => "id, CONCAT(lastname, ', ', firstname) AS employee, country", 'match' => "id > 1", 'order' => "employee ASC");
$employee = new Employee();
$result = $employee->find($criteria);
$id = 'job_owners_filter';
if ($_is_applicants) {
$id = 'ref_job_owners_filter';
}
echo '<select id="' . $id . '">' . "\n";
echo '<option value="0">Everyone</option>' . "\n";
echo '<option value="0" disabled> </option>' . "\n";
echo '<option value="' . $this->employee->getId() . '" selected>Myself</option>' . "\n";
foreach ($result as $row) {
if ($row['id'] != $this->employee->getId()) {
echo '<option value="' . $row['id'] . '">' . $row['employee'] . ' (' . $row['country'] . ')' . '</option>' . "\n";
}
}
echo '</select>';
}
示例11: getUserProfile
/**
* This function shows user profile
*/
public function getUserProfile()
{
if (Session::get('admin') == 'admin') {
$user = User::where('username', '=', Session::get('username'))->get()->first();
$userProfile = Admin::find($user->details_id);
$userProfile->DOB = DateFormat::show($userProfile->DOB);
return View::make('user.profile')->with('userProfile', $userProfile);
}
if (Session::get('employee') == 'employee') {
$user = User::where('username', '=', Session::get('username'))->get()->first();
$userProfile = Employee::find($user->details_id);
$userProfile->DOB = DateFormat::show($userProfile->DOB);
return View::make('user.profile')->with('userProfile', $userProfile);
}
if (Session::get('member') == 'member') {
$user = User::where('username', '=', Session::get('username'))->get()->first();
$userProfile = Member::find($user->details_id);
$userProfile->DOB = DateFormat::show($userProfile->DOB);
return View::make('user.profile')->with('userProfile', $userProfile);
}
}
示例12: postSignIn
public function postSignIn()
{
// check validation
$validator = Validator::make(Input::all(), array('username' => 'required', 'password' => 'required'));
// if validation is failed it's redirected
// to sign in page with validation errors
if ($validator->fails()) {
return Redirect::route('signin-get')->withErrors($validator)->withInput();
} else {
$remember = Input::has('remember') ? true : false;
$auth = Auth::attempt(array('username' => Input::get('username'), 'password' => trim(Input::get('password')), 'active' => 1), $remember);
if ($auth) {
$user = User::where('username', '=', Input::get('username'))->get()->first();
// Holding all important data
// from database to session
// variable
Session::put('username', $user->username);
Session::put('user_level', $user->user_level);
Session::put('user_id', $user->id);
Session::put('wc_msg', 1);
if ($user->user_level === 'admin') {
Session::put('admin', 'admin');
Session::put('employee_id', Employee::find($user->details_id)->id);
return Redirect::intended('/admin');
} elseif ($user->user_level === 'employee') {
Session::put('employee', 'employee');
Session::put('employee_id', Employee::find($user->details_id)->id);
return Redirect::intended('/employee');
} elseif ($user->user_level === 'member') {
Session::put('member', 'member');
Session::put('member_id', Member::find($user->details_id)->id);
return Redirect::intended('/member');
}
} else {
return View::make('userAuthentication.signin')->with('invalid', 'Invalid Username/Password.');
}
}
}
示例13: function
Route::post('leaveReports/approvedleaves', 'ReportsController@approvedleaves');
Route::get('leaveReports/selectRejectedPeriod', 'ReportsController@rejectedperiod');
Route::post('leaveReports/rejectedleaves', 'ReportsController@rejectedleaves');
Route::get('leaveReports/selectLeave', 'ReportsController@balanceselect');
Route::post('leaveReports/leaveBalances', 'ReportsController@leavebalances');
Route::get('leaveReports/selectLeaveType', 'ReportsController@leaveselect');
Route::post('leaveReports/Employeesonleave', 'ReportsController@employeesleave');
Route::get('leaveReports/selectEmployee', 'ReportsController@employeeselect');
Route::post('leaveReports/IndividualEmployeeLeave', 'ReportsController@individualleave');
Route::get('api/dropdown', function () {
$id = Input::get('option');
$bbranch = Bank::find($id)->bankbranch;
return $bbranch->lists('bank_branch_name', 'id');
});
Route::get('empedit/{id}', function ($id) {
$employee = Employee::find($id);
$branches = Branch::all();
$departments = Department::all();
$jgroups = JGroup::all();
$etypes = EType::all();
$banks = Bank::all();
$bbranches = BBranch::all();
return View::make('employees.cssedit', compact('branches', 'departments', 'etypes', 'jgroups', 'banks', 'bbranches', 'employee'));
});
Route::get('css/payslips', function () {
$employeeid = DB::table('employee')->where('personal_file_number', '=', Confide::user()->username)->pluck('id');
$employee = Employee::findorfail($employeeid);
return View::make('css.payslip', compact('employee'));
});
Route::get('css/leave', function () {
$employeeid = DB::table('employee')->where('personal_file_number', '=', Confide::user()->username)->pluck('id');
示例14: individualleave
public function individualleave()
{
$id = Input::get("employeeid");
$employee = Employee::find($id);
$leavetypes = Leavetype::all();
$organization = Organization::find(1);
$pdf = PDF::loadView('leavereports.individualReport', compact('leavetypes', 'employee', 'organization'))->setPaper('a4')->setOrientation('potrait');
return $pdf->stream($employee->first_name . '_' . $employee->last_name . '_Leave_Report.pdf');
}
示例15: updateEmployee
public static function updateEmployee($data)
{
Employee::find($data->eid)->update(array('ename' => $data->ename, 'ebirth' => $data->ebirth, 'egender' => $data->egender, 'etel' => $data->etel, 'eemail' => $data->eemail, 'eaddress' => $data->eaddress, 'dcode' => $data->dcode, 'rcode' => $data->rcode));
}