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

@ -650,12 +650,14 @@ class PodcastController extends BaseController
->with('errors', $this->validator->getErrors());
}
$validData = $this->validator->getValidated();
$db = db_connect();
$db->transStart();
$publishMethod = $this->request->getPost('publication_method');
$publishMethod = $validData['publication_method'];
if ($publishMethod === 'schedule') {
$scheduledPublicationDate = $this->request->getPost('scheduled_publication_date');
$scheduledPublicationDate = $validData['scheduled_publication_date'];
if ($scheduledPublicationDate) {
$this->podcast->published_at = Time::createFromFormat(
'Y-m-d H:i',
@ -783,12 +785,14 @@ class PodcastController extends BaseController
->with('errors', $this->validator->getErrors());
}
$validData = $this->validator->getValidated();
$db = db_connect();
$db->transStart();
$publishMethod = $this->request->getPost('publication_method');
$publishMethod = $validData['publication_method'];
if ($publishMethod === 'schedule') {
$scheduledPublicationDate = $this->request->getPost('scheduled_publication_date');
$scheduledPublicationDate = $validData['scheduled_publication_date'];
if ($scheduledPublicationDate) {
$this->podcast->published_at = Time::createFromFormat(
'Y-m-d H:i',