/** * Handle the command * * @param $command * @return mixed */ public function handle($command) { $status = Status::publish($command->body); $status = $this->statusRepository->save($status, $command->userId); $this->dispatchEventsFor($status); return $status; }
/** * Execute the job. * * @param StatusRepository $repository * @return static */ public function handle(StatusRepository $repository) { $body = $this->body; $status = Status::publish(compact('body')); $status = $repository->save($status); return $status; }
/** * Handle a command. * * @param $command * @return mixed */ public function handle($command) { $status = Status::publish($command->body); $this->repository->save($status, $command->user_id); $this->dispatcher->dispatch($status->releaseEvents()); return $status; }
/** * Display a listing of the resource. * * @return Response */ public function index() { if (Auth::guest()) { return Redirect::home(); } // $statuses = $this->statusRepository->getAllForUser(Auth::user()); $statuses = $this->statusRepository->getFeedForUser(Auth::user()); // dd(compact($statuses)); return View::make('statuses.index', compact('statuses'))->withUser(Auth::user()); }
/** @test */ public function it_saves_a_status_for_a_user() { // Given $user = TestDummy::create('Larabook\\Users\\User'); $unsavedStatus = TestDummy::build('Larabook\\Statuses\\Status', ['body' => 'This is a test status', 'user_id' => null]); // When $this->repository->save($unsavedStatus, $user->id); // Then $this->tester->seeRecord('statuses', ['body' => 'This is a test status', 'user_id' => $user->id]); }
/** * Handle the command. * * @param object $command * @return void */ public function handle($command) { $comment = $this->statusRepo->leaveComment($command->user_id, $command->status_id, $command->body); return $comment; }
/** * Display a listing of the resource. * * @return Response */ public function index() { $statuses = $this->statusRepository->getFeedForUser(Auth::user()); return View::make('statuses.index', compact('statuses')); }
/** * Handle a command. * * @param $command * @return mixed */ public function handle($command) { $comment = $this->repository->leaveComment($command->user_id, $command->status_id, $command->body); }
/** * Handle the process of leaving a comment for a status. * * @param object $command * @return void */ public function handle($command) { $comment = $this->statusRepo->leaveComment($command->user_id, $command->status_id, $command->body); // Viewer: anything else you want to do here? Dispatch events, etc. return $comment; }
/** * Display a listing of the resource. * * @param StatusRepository $repository * @return Response */ public function index(StatusRepository $repository) { $statuses = $repository->getFeedForUser(Auth::user()); return view('statuses.index')->withStatuses($statuses); }