コード例 #1
0
 /** @test */
 public function it_unfollows_another_user()
 {
     // Given
     $users = TestDummy::times(2)->create('Larabook\\Users\\User');
     // When
     $this->repository->follow($users[1]->id, $users[0]);
     $this->repository->unfollow($users[1]->id, $users[0]);
     // Then
     $this->tester->dontSeeRecord('follows', ['follower_id' => $users[0]->id, 'followed_id' => $users[1]->id]);
 }
コード例 #2
0
 /**
  * Handle the command.
  *
  * @param object $command
  * @return void
  */
 public function handle($command)
 {
     $user = $this->userRepo->findById($command->userId);
     $this->userRepo->unfollow($command->userIdToUnfollow, $user);
 }
コード例 #3
0
 /**
  * Execute the job.
  *
  * @param $request
  * @param UserRepository $repository
  * @return mixed
  */
 public function handle(UserRepository $repository)
 {
     $user = $repository->findById($this->userId);
     $repository->unfollow($this->userIdToUnfollow, $user);
     return $user;
 }
コード例 #4
0
 /**
  * Follow a Larabook user.
  *
  * @param $command
  * @return mixed
  */
 public function handle($command)
 {
     $follower = $this->repository->findById($command->follower);
     $this->repository->unfollow($command->userToUnfollow, $follower);
     return $follower;
 }