コード例 #1
0
ファイル: UpdateShift.php プロジェクト: sctape/scheduler
 /**
  * @param ShiftRepository $shiftRepository
  * @return Shift
  */
 public function handle(ShiftRepository $shiftRepository)
 {
     $this->shift->setBreak($this->break);
     $this->shift->setStartTime($this->start_time);
     $this->shift->setEndTime($this->end_time);
     $shiftRepository->update($this->shift);
     return $this->shift;
 }
コード例 #2
0
ファイル: CreateShift.php プロジェクト: sctape/scheduler
 /**
  * @param UserRepository $userRepository
  * @param ShiftRepository $shiftRepository
  * @param Shift $shift
  * @param Guard $auth
  * @return Shift
  */
 public function handle(UserRepository $userRepository, ShiftRepository $shiftRepository, Shift $shift, Guard $auth)
 {
     $shift->setBreak($this->break);
     $shift->setStartTime($this->start_time);
     $shift->setEndTime($this->end_time);
     if ($this->employee_id) {
         $shift->setEmployee($userRepository->getOneById($this->employee_id));
     }
     if ($this->manager_id) {
         $shift->setManager($userRepository->getOneById($this->manager_id));
     } else {
         $shift->setManager($auth->getUser());
     }
     $shiftRepository->store($shift);
     $shiftRepository->update($shift);
     return $shift;
 }
コード例 #3
0
 public function handle(CreateShift $command)
 {
     $this->shift->setBreak($command->break);
     $this->shift->setEmployee($this->userRepository->getOneById($command->employee_id));
     $this->shift->setManager($this->userRepository->getOneById($command->manager_id));
     $this->shift->setStartTime($command->start_time);
     $this->shift->setEndTime($command->end_time);
     $this->shiftRepository->store($this->shift);
     return $this->shift;
 }
コード例 #4
0
 /**
  * Include shift coworkers
  *
  * @param Shift $shift
  * @return \League\Fractal\Resource\Collection
  */
 public function includeCoworkers(Shift $shift)
 {
     $coworkers = $shift->getCoworkers();
     return $this->collection($coworkers, new UserTransformer());
 }
コード例 #5
0
ファイル: AssignShift.php プロジェクト: sctape/scheduler
 /**
  * @param ShiftRepository $shiftRepository
  * @return Shift
  */
 public function handle(ShiftRepository $shiftRepository)
 {
     $this->shift->setEmployee($this->user);
     $shiftRepository->update($this->shift);
     return $this->shift;
 }
コード例 #6
0
 /**
  * Include Manager
  *
  * @param Shift $shift
  * @return \League\Fractal\Resource\Item
  */
 public function includeManager(Shift $shift)
 {
     $manager = $shift->getManager();
     return $this->item($manager, new UserTransformer());
 }