#926 Toplu ilan onaylamada finish at eklenmiyor.

This commit is contained in:
Diatrex 2020-03-02 11:40:19 +03:00
parent 5b6fd72507
commit 0ae2a5a99e

View File

@ -1,22 +1,24 @@
<?php namespace Visiosoft\AdvsModule\Adv\Table\Handler; <?php namespace Visiosoft\AdvsModule\Adv\Table\Handler;
use Anomaly\SettingsModule\Setting\Contract\SettingRepositoryInterface;
use Anomaly\Streams\Platform\Ui\Table\Component\Action\ActionHandler; use Anomaly\Streams\Platform\Ui\Table\Component\Action\ActionHandler;
use Visiosoft\AdvsModule\Adv\Table\AdvTableBuilder; use Visiosoft\AdvsModule\Adv\Table\AdvTableBuilder;
class Approve extends ActionHandler class Approve extends ActionHandler
{ {
public function handle(AdvTableBuilder $builder, array $selected) public function handle(AdvTableBuilder $builder, array $selected, SettingRepositoryInterface $settingRepository)
{ {
$model = $builder->getTableModel(); $model = $builder->getTableModel();
foreach ($selected as $id) { foreach ($selected as $id) {
$defaultAdPublishTime = $settingRepository->value('visiosoft.module.advs::default_published_time');
$entry = $model->find($id); $model->newQuery()->find($id)->update([
'status' => 'approved',
$entry->status = 'approved'; 'finish_at' => date('Y-m-d H:i:s', strtotime(date('Y-m-d H:i:s') . ' + ' . $defaultAdPublishTime . ' day')),
'publish_at' => date('Y-m-d H:i:s')
$entry->update(); ]);
} }
if ($selected) { if ($selected) {