public function edit($id, UserRepository $userReposiory, CountryRepository $countryRepository) { $user = $userReposiory->findUser($id); $countries = $countryRepository->getAllCountries(); $pageTitle = 'Edit a customer'; return view('users.edit', compact('pageTitle', 'user', 'countries')); }
/** * Execute the job. * * @return void */ public function handle(UserRepository $repository, Flash $flash) { $user = $repository->findUser($this->id); if ($user->email != $this->data['email']) { if ($repository->findUserByEmail($this->data['email'])) { $flash->error('Email already exists.'); return null; } } return $repository->updateUser($this->id, $this->data); }