/** * Handle the command. * * @param CreateStaffCommand $command * @return void */ public function handle(CreateStaffCommand $command) { $staff_object = Staff::make($command->name, str_slug($command->name, '-'), $command->intro, $command->description, $command->email); $staff = $this->repo->save($staff_object); Event::fire(new StaffWasCreated($staff)); return $staff; }
/** * Handle the command. * * @param UpdateStaffCommand $command * @return void */ public function handle(UpdateStaffCommand $command) { $staff_object = Staff::edit($command->staff_id, $command->name, str_slug($command->name, '-'), $command->intro, $command->description, $command->featured_image_id, $command->email); $staff = $this->repo->save($staff_object); Event::fire(new StaffWasUpdated($staff)); return $staff; }
public function getById($id) { return Staff::with('media', 'featuredImage')->whereId($id)->first(); }