refactor: use Validation::getValidated() when using $this->validate() in controllers

This commit is contained in:
Yassine Doghri 2023-08-29 15:42:52 +00:00
commit 2c07070b2c
18 changed files with 129 additions and 70 deletions

View file

@ -70,7 +70,9 @@ class LockController extends BaseController
->with('errors', $this->validator->getErrors());
}
$token = (string) $this->request->getPost('token');
$validData = $this->validator->getValidated();
$token = $validData['token'];
// attempt unlocking the podcast with the token
if (! $this->premiumPodcasts->unlock($this->podcast->handle, $token)) {
@ -83,7 +85,8 @@ class LockController extends BaseController
$redirectURL = session('redirect_url') ?? site_url('/');
unset($_SESSION['redirect_url']);
return redirect()->to($redirectURL)
return redirect()
->to($redirectURL)
->withCookies()
->with('message', lang('PremiumPodcasts.messages.unlockSuccess'));
}