/** * Display a listing of the resource. * * @param UserRepositoryInterface $userRepository * @param ProjectRepositoryInterface $projectRepository * @param Request $request * @return \Illuminate\Http\Response */ public function index(UserRepositoryInterface $userRepository, ProjectRepositoryInterface $projectRepository, Request $request) { $projects = $userRepository->drafts($request->user()->id); $publishedProjects = $userRepository->published($request->user()->id); $failedProjects = $userRepository->failed($request->user()->id); return view('user.project.index', compact('projects', 'publishedProjects', 'failedProjects')); }
/** * Execute the command. * * @param UserRepositoryInterface $repository * @param Dispatcher $event */ public function handle(UserRepositoryInterface $repository, Dispatcher $event) { $status = $repository->update($this->user->getAttribute('id'), $this->fields); if (!$status) { dd('user wasnt updated somehow'); } $event->fire(new UserWasUpdated($this->user)); }
/** * Execute the command. * * @param UserRepositoryInterface $repository * @param Dispatcher $event */ public function handle(UserRepositoryInterface $repository, Dispatcher $event) { /** * Create User */ $user = $repository->create($this->fields); /** * Announce UserWasCreated */ $event->fire(new UserWasCreated($user, $this->role)); }