/** * Index handler. * * @param \Psr\Http\Message\ServerRequestInterface $psrRequest * @param \Laravel\Passport\ClientRepository $clients * * @return \Illuminate\Http\Response */ public function index(ServerRequestInterface $psrRequest, ClientRepository $clients) { return $this->withErrorHandling(function () use($psrRequest, $clients) { $this->request->session()->put('authRequest', $authRequest = $this->server->validateAuthorizationRequest($psrRequest)); $scopes = $this->parseScopes($authRequest); return $this->response->view('passport::authorize', ['client' => $clients->find($authRequest->getClient()->getIdentifier()), 'user' => $this->request->user(), 'scopes' => $scopes, 'request' => $this->request]); }); }
/** * Update handler. * * @param $clientId * * @return \Illuminate\Http\Response|\Laravel\Passport\Client * @throws \Illuminate\Validation\ValidationException */ public function update($clientId) { if (!$this->request->user()->clients->find($clientId)) { return new Response('', 404); } $this->validation->make($this->request->all(), ['name' => 'required|max:255', 'redirect' => 'required|url'])->validate(); return $this->clients->update($this->request->user()->clients->find($clientId), $this->request->name, $this->request->redirect); }