/** * Execute the job. * * @param UserRepository $repository * @return User */ public function handle(UserRepository $repository) { $user = User::register($this->username, $this->email, $this->password); $repository->save($user); event(new \App\Events\UserRegistered($user)); return $user; }
/** * Execute the job. * * @param UserRepository $userRepository */ public function handle(UserRepository $userRepository) { $fallower = $userRepository->findById($this->userId); $userToFallow = $userRepository->findById($this->userIdToFallow); $userRepository->fallow($userToFallow, $fallower); return $fallower; }
/** @test */ public function it_unfallows_the_user() { # Given I have 2 users list($john, $susan) = Factory::times(2)->create(User::class); # And one user fallows another user $this->repo->fallow($susan, $john); # then I unfallow that same user $this->repo->unfallow($susan, $john); # Then I should NOT see the user in a list of those that $john fallows... $this->tester->dontSeeRecord('fallows', ['fallower_id' => $john->id, 'fallowed_id' => $susan->id]); }
/** * Execute the job. * * @param UserRepository $userRepository */ public function handle(UserRepository $userRepository) { $unfallower = $userRepository->findById($this->userId); $userToUnfallow = $userRepository->findById($this->userIdToUnfallow); $userRepository->unfallow($userToUnfallow, $unfallower); }
public function show(UserRepository $usersRepository, $username) { $user = $usersRepository->findByUsername($username); return view('users.show')->withUser($user); }
/** * Execute the job. * @param User $userModel * @param UserRepository $repository * @param Dispatcher $dispatcher */ public function handle(User $userModel, UserRepository $repository, Dispatcher $dispatcher) { $user = $userModel->register($this->username, $this->email, $this->password); $dispatcher->fire(new UserRegistered($user)); $repository->save($user); }