/**
  * @test
  */
 public function efficiency_report_logs()
 {
     $log = EfficiencyReportLog::first();
     $this->assertInstanceOf(Department::class, $log->department);
     $this->assertInstanceOf(EfficiencyIssue::class, $log->efficiencyIssue);
     $this->assertInstanceOf(User::class, $log->createdBy);
     $this->assertInstanceOf(User::class, $log->updatedBy);
     $this->assertInstanceOf(User::class, $log->shiftOperator);
 }
 /**
  * Store a new efficiency report log entry
  *
  * @param Request $request
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function store(StoreEfficiencyReportFormRequest $request)
 {
     $this->authorize('edit_efficiency_report');
     $log = EfficiencyReportLog::create($request->all());
     if ($request->exists('reason')) {
         $issue = EfficiencyIssue::create($request->all());
         $issue->efficiencyReportLogs()->save($log);
     }
     flash()->success('Efficiency Report Saved', 'New efficiency report entry has been made.');
     return redirect()->action('EfficiencyReportController@index');
 }
예제 #3
0
 /**
  * Overwrite the parent boot method
  *
  * @return void
  */
 public static function boot()
 {
     parent::boot();
     EfficiencyReportLog::creating(function ($efficiencyReportLog) {
         $efficiencyReportLog->created_by = \Auth::user()->id;
         $efficiencyReportLog->updated_by = \Auth::user()->id;
     });
     EfficiencyReportLog::updating(function ($efficiencyReportLog) {
         $efficiencyReportLog->updated_by = \Auth::user()->id;
     });
 }
예제 #4
0
 /**
  * Create a new job instance.
  *
  */
 public function __construct()
 {
     $this->logs = \App\Models\EfficiencyReportLog::LastSixHours()->get();
     $this->recipients = \App\User::DirectorsAndAdmin()->get();
 }