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


PHP Employee::findOrFail方法代码示例

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


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

示例1: single

 public function single($mr, $currentMonth)
 {
     $actualVisits = [];
     $MonthlyCustomerProducts = [];
     $MRLine = [];
     $doctors = Customer::where('mr_id', $mr)->get();
     foreach ($doctors as $singleDoctor) {
         $actualVisits[$singleDoctor->id] = Report::where('mr_id', $mr)->where('month', $currentMonth)->where('doctor_id', $singleDoctor->id)->count();
         $MonthlyCustomerProducts[$singleDoctor->id] = Customer::monthlyProductsBought([$singleDoctor->id])->toArray();
     }
     $products = Product::where('line_id', Employee::findOrFail($mr)->line_id)->get();
     $coverageStats = Employee::coverageStats($mr, $currentMonth);
     $allManagers = Employee::yourManagers($mr);
     $totalProducts = Employee::monthlyDirectSales($mr, $currentMonth);
     $totalSoldProductsSales = $totalProducts['totalSoldProductsSales'];
     $totalSoldProductsSalesPrice = $totalProducts['totalSoldProductsSalesPrice'];
     $currentMonth = \Carbon\Carbon::parse($currentMonth);
     $lines = MrLines::select('line_id', 'from', 'to')->where('mr_id', $mr)->get();
     foreach ($lines as $line) {
         $lineFrom = \Carbon\Carbon::parse($line->from);
         $lineTo = \Carbon\Carbon::parse($line->to);
         if (!$currentMonth->lte($lineTo) && $currentMonth->gte($lineFrom)) {
             $MRLine = MrLines::where('mr_id', $mr)->where('line_id', $line->line_id)->get();
         }
     }
     $dataView = ['doctors' => $doctors, 'MonthlyCustomerProducts' => $MonthlyCustomerProducts, 'actualVisits' => $actualVisits, 'products' => $products, 'totalVisitsCount' => $coverageStats['totalVisitsCount'], 'actualVisitsCount' => $coverageStats['actualVisitsCount'], 'totalMonthlyCoverage' => $coverageStats['totalMonthlyCoverage'], 'allManagers' => $allManagers, 'totalSoldProductsSales' => $totalSoldProductsSales, 'totalSoldProductsSalesPrice' => $totalSoldProductsSalesPrice, 'MRLines' => $MRLine];
     return view('am.line.single', $dataView);
 }
开发者ID:m-gamal,项目名称:crm,代码行数:28,代码来源:LineController.php

示例2: update

 /**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  int  $id
  * @return Response
  */
 public function update(EmployeeRequest $request, $id)
 {
     $employee = Employee::findOrFail($id);
     $employee->update($request->all());
     flash()->success('Success!', 'Employee details saved successfully!');
     return redirect('employees');
 }
开发者ID:amolkattel,项目名称:Asset-Mgnt-Project,代码行数:14,代码来源:EmployeesController.php

示例3: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $employee = Employee::findOrFail($id);
     $name = $employee->name . " " . $employee->lastname;
     Employee::destroy($id);
     return redirect(route('employees.index'))->with('message', 'Empleado ' . $name . ' eliminado corectamente');
 }
开发者ID:edwardricardo,项目名称:zenska,代码行数:13,代码来源:EmployeeController.php

示例4: update

 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $employee = Employee::findOrFail(Input::get('id'));
     $employee->first_name = Input::get('first_name');
     $employee->last_name = Input::get('last_name');
     $employee->name = Input::get('first_name') . ' ' . Input::get('last_name');
     $employee->email = Input::get('email');
     $employee->position = Input::get('position');
     $employee->phone = Input::get('phone');
     $employee->location_id = Input::get('location');
     $employee->status = 1;
     $employee->role_id = 5;
     $employee->department = Input::get('department');
     $employee->extension_no = Input::get('extension_no');
     $employee->vehicle_no = Input::get('vehicle_no');
     $employee->save();
     return Response::json(array('success' => 'Employee has been updated!'));
 }
开发者ID:subhadip-sahoo,项目名称:laravel,代码行数:24,代码来源:EmployeeController.php

示例5: doCreate

 public function doCreate(CreateMessageRequest $request)
 {
     $uploaded = false;
     foreach ($request->employees as $key => $singleEmployee) {
         $user = Employee::findOrFail($singleEmployee);
         $message = new Message();
         $message->sender = \Auth::user()->id;
         $message->receiver = $singleEmployee;
         $message->subject = $request->subject;
         $message->time = \Carbon\Carbon::now()->toTimeString();
         if ($message->save()) {
             $messageReply = new MessageReply();
             $messageReply->sender = \Auth::user()->id;
             $messageReply->msg_id = $message->id;
             $messageReply->text = $request->message;
             $messageReply->time = \Carbon\Carbon::now()->toTimeString();
             \File::makeDirectory(public_path('uploads/inbox/') . $message->id);
             if ($messageReply->save()) {
                 if ($request->file('attachment')) {
                     $file = $request->file('attachment');
                     $messageReply->is_attachment = 1;
                     $messageReply->save();
                     $extension = $file->getClientOriginalExtension();
                     if ($file->isValid()) {
                         if ($uploaded) {
                             copy($uploaded, public_path('uploads/inbox/' . $this->originalDir));
                         } else {
                             if ($file->move(public_path('uploads/inbox/' . $message->id), $messageReply->id . '.' . $extension)) {
                                 $uploaded = public_path('uploads/inbox/' . $message->id) . '/' . $messageReply->id . '.' . $extension;
                                 $this->originalDir = $message->id;
                             }
                         }
                     }
                 }
             }
             \Mail::send('admin.emails.new_message', ['user' => $user], function ($m) use($user) {
                 $m->from('info@cloudscrm.info', 'CloudsCRM');
                 $m->to($user->email, $user->name)->subject('New Message!');
             });
         }
     }
     return redirect()->back()->with('message', 'Message has been sent successfully !');
 }
开发者ID:m-gamal,项目名称:crm,代码行数:43,代码来源:InboxController.php

示例6: logDriver

 public function logDriver($id)
 {
     return $id == 999999999 ? 'Client Driver' : ($id == 0 ? '' : Employee::findOrFail($id)->name);
 }
开发者ID:smartrahat,项目名称:zamzam,代码行数:4,代码来源:VehicleRepository.php

示例7: postEditSMProfile

 public function postEditSMProfile(SMRequest $request)
 {
     $employee = Employee::findOrFail(\Auth::user()->id);
     $employee->name = $request->name;
     $employee->email = $request->email;
     $employee->password = \Hash::make($request->password);
     try {
         $employee->save();
         return redirect()->back()->with('message', 'Your Profile has been updated successfully !');
     } catch (ParseException $ex) {
         echo 'Failed to update your profile , with error message: ' . $ex->getMessage();
     }
 }
开发者ID:m-gamal,项目名称:crm,代码行数:13,代码来源:AuthController.php

示例8: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $employee = Employee::findOrFail($id);
     $employee->delete();
     return Redirect::action('EmployeeController@index');
 }
开发者ID:MangTomas23,项目名称:tgm,代码行数:12,代码来源:EmployeeController.php

示例9: update

 public function update(Request $request, $id)
 {
     $employee = Employee::findOrFail($id);
     $employee->update($request::all());
     return $employee;
 }
开发者ID:hoangnh228,项目名称:angularavel,代码行数:6,代码来源:EmployeeController.php

示例10: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $employee = Employee::findOrFail($id)->delete();
     return Redirect::route('admin.employee.list.index')->withFlashSuccess('Employee data was successfully deleted.');
 }
开发者ID:krizzna,项目名称:hrportal,代码行数:11,代码来源:EmployeeController.php

示例11: changeClient

 /**
  * Store client information associated with driver
  * @param Request $request
  * Created by smartrahat Date: 04.11.2015 Time: 02:39PM
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function changeClient(Request $request)
 {
     $request['action'] = 'Add';
     $request['c_description'] = 'Add driver';
     $request['e_description'] = 'Assign to client';
     $employee = Employee::findOrFail($request['eid']);
     $employee->update($request->only('cid'));
     Log::create($request->all());
     return redirect('employee/' . $request['eid']);
 }
开发者ID:smartrahat,项目名称:zamzam,代码行数:16,代码来源:EmployeeController.php

示例12: handleDeleteEmployee

 public function handleDeleteEmployee()
 {
     // Handle the delete confirmation.
     $id = Input::get('employee');
     $employee = Employee::findOrFail($id);
     $employee->delete();
     return Redirect::action('CommonController@employees');
 }
开发者ID:subhadip-sahoo,项目名称:laravel,代码行数:8,代码来源:CommonController.php

示例13: removeDriver

 public function removeDriver(Request $request)
 {
     $redirect = $request['cid'];
     $request['c_description'] = 'Driver removed';
     $request['e_description'] = 'Removed form client';
     $request['action'] = 'Remove';
     Log::create($request->all());
     // update log
     $driver = Employee::findOrFail($request['eid']);
     $request['cid'] = 0;
     $driver->update($request->only(['cid']));
     // update driver's foreign key
     return redirect('client/' . $redirect);
 }
开发者ID:smartrahat,项目名称:zamzam,代码行数:14,代码来源:ClientController.php

示例14: doDelete

 public function doDelete($id)
 {
     $employee = Employee::findOrFail($id);
     try {
         $this->deletAvatar($id);
         $employee->delete();
         return redirect()->back()->with('message', 'Employee has been deleted successfully !');
     } catch (ParseException $ex) {
         echo 'Failed to delete this employee , with error message: ' . $ex->getMessage();
     }
 }
开发者ID:m-gamal,项目名称:crm,代码行数:11,代码来源:EmployeeController.php

示例15: search

 public function search()
 {
     $doctors = Customer::where('mr_id', \Auth::user()->id)->get();
     $MRLine = Employee::findOrFail(\Auth::user()->id)->line_id;
     $products = Product::where('line_id', $MRLine)->get();
     $gifts = Gift::all();
     $dataView = ['doctors' => $doctors, 'products' => $products, 'gifts' => $gifts];
     return view('mr.search.reports.search', $dataView);
 }
开发者ID:m-gamal,项目名称:crm,代码行数:9,代码来源:ReportController.php


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