mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
Merge pull request #129 from openclassify/diatrex
mass ad date update (extend)
This commit is contained in:
commit
5b04e32550
@ -10,6 +10,7 @@ return [
|
||||
'new_village' => 'New Village',
|
||||
'approve' => "Approve",
|
||||
'decline' => 'Decline',
|
||||
'extend' => 'Extend',
|
||||
'sub_category' => 'Sub Categories',
|
||||
'add_sub_category' => 'Add Sub Category',
|
||||
'sub_cities' => 'Sub Cities',
|
||||
|
||||
@ -153,6 +153,7 @@ return [
|
||||
'send_us_your_feedback' => 'Send Us Your Feedback',
|
||||
'online_shopping' => 'GET',
|
||||
'approved' => 'Approved Successfully',
|
||||
'extended' => 'Extended Successfully',
|
||||
'declined' => 'Declined Successfully',
|
||||
'search_on_map' => 'Search on Map',
|
||||
'post_free_ad' => 'Post Free Ad',
|
||||
|
||||
@ -69,6 +69,10 @@ class AdvTableBuilder extends TableBuilder
|
||||
'handler' => \Visiosoft\AdvsModule\Adv\Table\Handler\Decline::class,
|
||||
'class' => 'btn btn-danger'
|
||||
],
|
||||
'extend' => [
|
||||
'handler' => \Visiosoft\AdvsModule\Adv\Table\Handler\Extend::class,
|
||||
'class' => 'btn btn-info'
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
@ -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'));
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user