mass ad date update (extend)

This commit is contained in:
Diatrex 2019-10-29 17:48:01 +03:00
parent ff585f7512
commit 964f4063b4
4 changed files with 29 additions and 0 deletions

View File

@ -10,6 +10,7 @@ return [
'new_village' => 'New Village', 'new_village' => 'New Village',
'approve' => "Approve", 'approve' => "Approve",
'decline' => 'Decline', 'decline' => 'Decline',
'extend' => 'Extend',
'sub_category' => 'Sub Categories', 'sub_category' => 'Sub Categories',
'add_sub_category' => 'Add Sub Category', 'add_sub_category' => 'Add Sub Category',
'sub_cities' => 'Sub Cities', 'sub_cities' => 'Sub Cities',

View File

@ -153,6 +153,7 @@ return [
'send_us_your_feedback' => 'Send Us Your Feedback', 'send_us_your_feedback' => 'Send Us Your Feedback',
'online_shopping' => 'GET', 'online_shopping' => 'GET',
'approved' => 'Approved Successfully', 'approved' => 'Approved Successfully',
'extended' => 'Extended Successfully',
'declined' => 'Declined Successfully', 'declined' => 'Declined Successfully',
'search_on_map' => 'Search on Map', 'search_on_map' => 'Search on Map',
'post_free_ad' => 'Post Free Ad', 'post_free_ad' => 'Post Free Ad',

View File

@ -69,6 +69,10 @@ class AdvTableBuilder extends TableBuilder
'handler' => \Visiosoft\AdvsModule\Adv\Table\Handler\Decline::class, 'handler' => \Visiosoft\AdvsModule\Adv\Table\Handler\Decline::class,
'class' => 'btn btn-danger' 'class' => 'btn btn-danger'
], ],
'extend' => [
'handler' => \Visiosoft\AdvsModule\Adv\Table\Handler\Extend::class,
'class' => 'btn btn-info'
],
]; ];
/** /**

View File

@ -0,0 +1,23 @@
<?php namespace Visiosoft\AdvsModule\Adv\Table\Handler;
use Anomaly\Streams\Platform\Ui\Table\Component\Action\ActionHandler;
use Visiosoft\AdvsModule\Adv\Table\AdvTableBuilder;
class Extend extends ActionHandler
{
public function handle(AdvTableBuilder $builder, array $selected)
{
$model = $builder->getTableModel();
foreach ($selected as $id) {
$entry = $model->find($id);
$finishAt = $entry->finish_at ? $entry->finish_at->addDay(30) : date('Y-m-d H:i:s', strtotime(date('Y-m-d H:i:s') . ' + 30 day'));
$entry->finish_at = $finishAt;
$entry->update();
}
if ($selected) {
$this->messages->success(trans('visiosoft.module.advs::field.extended'));
}
}
}