本文整理汇总了PHP中app\Employee::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Employee::find方法的具体用法?PHP Employee::find怎么用?PHP Employee::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Employee
的用法示例。
在下文中一共展示了Employee::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
/**
* Deletes employee from database and returns status in json response
*
* @param $id
* @return array
*/
public function delete($id)
{
if ($employee = $this->employee->find($id)) {
if ($employee->delete()) {
return ['status' => 200];
}
return ['status' => 500];
}
return ['status' => 404];
}
示例2: search
public function search()
{
$products = Product::where('line_id', Employee::find(\Auth::user()->id)->line_id)->get();
$doctors = Customer::where('mr_id', \Auth::user()->id)->get();
$dataView = ['products' => $products, 'doctors' => $doctors];
return view('mr.search.sales.search', $dataView);
}
示例3: update
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
//
$data = $request->except(['_token', '_method']);
$employee = Employee::find($id);
$employee->update($data);
return redirect()->to('employees');
}
示例4: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$faker = \Faker\Factory::create();
$rows = Employee::all();
foreach ($rows as $row) {
Employee::find($row->id)->account()->where('employee_id', $row->user_id)->update(['access_level' => $faker->randomElement(['User', 'Admin']), 'status' => $faker->randomElement(['Active', 'Deactivated']), 'password' => bcrypt('8d')]);
}
}
示例5: show
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
$employee = Employee::find($id);
$laptop = Employee::find($id)->laptop;
$desktop = Employee::find($id)->desktop;
$apple = Employee::find($id)->apple;
$android = Employee::find($id)->android;
return view('employees.show', compact('employee', 'laptop', 'desktop', 'apple', 'android'));
}
示例6: save
/**
* Saves new vacation entry to database and returns status in json response
*
* @TODO: move logic out of controller
*
* @param Request $request
* @return array
*/
public function save(Request $request)
{
$employee = $this->employee->find($request->input('employee_id'));
$vacationStart = new Carbon($request->input('start'));
$vacationEnd = new Carbon($request->input('end'));
$duration = $vacationStart->diffInDays($vacationEnd);
if ($duration > $employee->vacationsLeft || $vacationEnd <= $vacationStart) {
return ['status' => 403];
}
$overlapingVacations = $employee->vacations()->where('end', '>', $vacationStart)->where('start', '<', $vacationEnd)->get();
if (!$overlapingVacations->isEmpty()) {
return ['status' => 403];
}
$vacation = $this->vacation->create($request->all());
$vacation->duration = $duration;
if ($vacation->save()) {
return ['status' => 200];
}
return ['status' => 500];
}
示例7: show
/**
* Show Cv information
*
* @param int $id
* @return Response
*/
public function show($id)
{
$positions = Position::all();
$employee = Employee::find($id);
$educations = Education::where('employee_id', '=', $employee->id)->get();
$employee_skills = EmployeeSkill::where('employee_id', '=', $employee->id)->get();
$experiences = WorkingExperience::where('employee_id', '=', $employee->id)->get();
$taken_projects = TakenProject::where('employee_id', '=', $employee->id)->get();
$nationalities = Nationality::all();
$category_skill = CategorySkill::all();
return view('printpreview.printpreview', compact('taken_projects', 'position', 'employee_skills', 'nationalities', 'employee', 'educations', 'experiences', 'category_skill'));
}
示例8: create
public function create($doctorId = NULL)
{
$description_names = Customer::distinct()->select('description_name')->where('mr_id', \Auth::user()->id)->get();
$doctors = Customer::where('mr_id', \Auth::user()->id)->get();
$products = Product::where('line_id', Employee::find(\Auth::user()->id)->line_id)->get();
$gifts = Gift::all();
$allManagers = Employee::yourManagers(\Auth::user()->id);
$dataView = ['description_names' => $description_names, 'doctors' => $doctors, 'products' => $products, 'gifts' => $gifts, 'doctorId' => !empty($doctorId) ? $doctorId : '', 'allManagers' => $allManagers];
if (!empty($doctorId)) {
\Session::set('planned_visit', 1);
}
return view('mr.report.create', $dataView);
}
示例9: show
/**
* Show and Export CV information
*
* @param [int] $id
* @return Response
*/
public function show($id)
{
$positions = Position::all();
$employee = Employee::find($id);
$educations = Education::where('employee_id', '=', $employee->id)->get();
$employee_skills = EmployeeSkill::where('employee_id', '=', $employee->id)->get();
$experiences = WorkingExperience::where('employee_id', '=', $employee->id)->get();
$taken_projects = TakenProject::where('employee_id', '=', $employee->id)->get();
$nationalities = Nationality::all();
$category_skill = CategorySkill::all();
$parameterr = array();
$parameter['employee'] = $employee;
$parameter['educations'] = $educations;
$parameter['category_skill'] = $category_skill;
$parameter['employee_skills'] = $employee_skills;
$parameter['taken_projects'] = $taken_projects;
$parameter['experiences'] = $experiences;
$parameter['nationalities'] = $nationalities;
$pdf = \PDF::loadView('welcome', $parameter)->setPaper('a4')->setOrientation('landscape')->setWarnings(false);
return $pdf->download('cv.pdf');
}
示例10: moveEmployee
public function moveEmployee(Request $request)
{
if (!$request->has('team_id') || !$request->has('origin_team_id') || !$request->has('employee_id')) {
return $this->returnJsonError('missing_params');
}
$input = $request->only('team_id', 'origin_team_id', 'employee_id');
$company_id = (int) $input['team_id'];
$employee_id = (int) $input['employee_id'];
$employee = Employee::find($employee_id);
$company = Company::find($company_id);
if ($employee && $company) {
$employee->company_id = $company_id;
$employee->save();
return $this->returnJsonSuccess();
} else {
if (!$employee) {
return $this->returnJsonError('employee.miss');
}
if (!$company) {
return $this->returnJsonError('company.miss');
}
}
}
示例11: deleteEmployee
/**
* Delete Employee from the database
*
* @param Request $request
* @return \Illuminate\Http\RedirectResponse
*/
public function deleteEmployee(Request $request)
{
$employee = Employee::find($request->input('id'));
$employee->delete();
return redirect()->route('manageEmployees')->with('flash_message', 'Employee ' . $employee->firstname . ' ' . $employee->lastname . ' has been deleted');
}
示例12: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
//
Employee::find($id)->delete();
return redirect()->to('employee');
}
示例13: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
$employee = Employee::find($id);
$employee->delete();
return "Employee record successfully deleted #" . $id;
}
示例14: update
/**
* Update the specified resource in storage.
*
* @param int $id
* @return Response
*/
public function update()
{
$input = Input::all();
$employee = Employee::find($input['id']);
$rules = array('firstname' => 'required', 'lastname' => 'required', 'designation' => 'required');
$validator = Validator::make($input, $rules);
if ($validator->passes()) {
$employee->firstname = $input['firstname'];
$employee->lastname = $input['lastname'];
$employee->contact = $input['contact'];
$employee->address = $input['address'];
$employee->designation_id = $input['designation'];
$employee->save();
return Redirect::action('EmployeeController@index');
}
return Redirect::action('EmployeeController@show', $employee->id);
}
示例15: DelTeam
public function DelTeam($id, $id_team)
{
// Start Check Authorization
/**
* 1. FullAccess - 1
* 2. HRD - 3
* 3. Creator - 5
* 4. Handler - 7
*/
$invalid_auth = 1;
$authRole = Auth::user()->UserRoles->role;
if ($authRole == 7 or $authRole == 1 or $authRole == 3) {
$invalid_auth = 0;
}
if ($invalid_auth == 1) {
Alert::error('Anda tidak memilik akses ini')->persistent('close');
return redirect('project/view/' . $id);
}
// End Check Authorization
$db = Team::find($id_team);
$db->status = 0;
$db->save();
$now = date('Y-m-d');
foreach ($db->tl as $tl) {
$db_tl = Teamleader::find($tl->id);
$db_tl->status = 0;
$db_tl->end = $now;
$db_tl->save();
}
foreach ($db->store as $store) {
$db_st = Store::find($store->id);
$db_st->status = 0;
$db_st->save();
foreach ($store->members as $gm) {
$db_gm = Member::find($gm->id);
$db_gm->status = 0;
$db_gm->end = $now;
$db_gm->save();
foreach ($gm->get_users as $gu) {
if ($gm->status == 1) {
$db_em = Employee::find($gu->id);
$db_em->status = 0;
$db_em->save();
}
}
}
}
Alert::success('Berhasil menonaktifkan !')->persistent("Close");
return redirect('project/view/' . $id)->with('message', 'Stop Team Success!');
}