/**
  * Handle the command
  *
  * @param $command
  * @return mixed
  */
 public function handle($command)
 {
     $user = User::register($command->username, $command->email, $command->password);
     $this->repository->save($user);
     $this->dispatchEventsFor($user);
     return $user;
 }
 public function handle(UserRepository $repository)
 {
     $username = $this->username;
     $email = $this->email;
     $password = $this->password;
     $user = User::register($username, $email, $password);
     $repository->save($user);
     return $user;
 }
 /** @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]);
 }
 /**
  * Execute the job.
  *
  * @param CommentRepository $repository
  * @param UserRepository $userRepository
  * @return static
  */
 public function handle(CommentRepository $repository, UserRepository $userRepository)
 {
     $user_id = $this->user_id;
     $status_id = $this->status_id;
     $body = $this->body;
     $comment = Comment::publish($status_id, $body);
     $user = $userRepository->findById($user_id);
     $repository->save($comment, $user);
     return $comment;
 }
 /**
  * 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;
 }
 /**
  * Handle the command.
  *
  * @param object $command
  * @return void
  */
 public function handle($command)
 {
     $user = $this->userRepo->findById($command->userId);
     $this->userRepo->unfollow($command->userIdToUnfollow, $user);
 }
示例#7
0
 /**
  * show
  *
  * @param mixed $username description
  *
  * @return mixed
  * @author Alonzo Tolver <*****@*****.**>
  *
  **/
 public function show($username)
 {
     $user = $this->userRepository->findByUsername($username);
     return View::make('users.show')->withUser($user);
 }
 /**
  * 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;
 }
 /**
  * Handle the command.
  *
  * @param object $command
  * @return void
  */
 public function handle($command)
 {
     $user = $this->userRepo->findById($command->userId);
     $this->userRepo->follow($command->userIdToFollow, $user);
     return $user;
 }
示例#10
0
 public function show($username)
 {
     $user = $this->repository->findByUsername($username);
     return view('users.show')->withUser($user);
 }