add extend all

This commit is contained in:
vedatakd 2020-02-18 12:50:43 +03:00
parent 7503c546e4
commit a44b456398
5 changed files with 21 additions and 2 deletions

View File

@ -11,6 +11,7 @@ return [
'approve' => "Approve",
'decline' => 'Decline',
'extend' => 'Extend',
'extend_all' => 'Extend All',
'sub_category' => 'Sub Categories',
'add_sub_category' => 'Add Sub Category',
'sub_cities' => 'Sub Cities',

View File

@ -10,7 +10,8 @@ return [
'new_village' => 'Yeni köy',
'approve' => "Onayla",
'decline' => 'Reddet',
'extend' => 'Uzat',
'extend' => 'Tarihi Güncelle',
'extend_all' => 'Tümünün Tarihini Güncelle',
'sub_category' => 'Alt Kategoriler',
'add_sub_category' => 'Alt Kategori Ekle',
'sub_cities' => 'Alt Şehirler',

View File

@ -30,6 +30,11 @@ class AdvsModule extends Module
'new_adv' => [
'href' => "/advs/create_adv",
],
'extend_all' => [
'href' => "/admin/advs/extendAll",
'icon' => 'fa fa-calendar',
'type' => 'info'
],
],
],
'assets_clear' => [

View File

@ -212,7 +212,10 @@ class AdvsModuleServiceProvider extends AddonServiceProvider
'as' => 'ajax::getAds',
'uses' => 'Visiosoft\AdvsModule\Http\Controller\AjaxController@getMyAds'
],
'admin/advs/extendAll' => [
'as' => 'advs::extendAll',
'uses' => 'Visiosoft\AdvsModule\Http\Controller\Admin\AdvsController@extendAll',
],
];
/**

View File

@ -257,4 +257,13 @@ class AdvsController extends AdminController
<a href='" . $request->server('HTTP_REFERER') . "'><b>Return Back</b></a>";
echo "<br><a href='/admin'><b>Return Admin Panel</b></a>";
}
public function extendAll()
{
$advs = $this->model->get();
$new_date = date('Y-m-d H:i:s', strtotime(date('Y-m-d H:i:s') . ' + ' . setting_value('visiosoft.module.advs::default_published_time') . ' day'));
$advs->update(['finish_at' => $new_date]);
$this->messages->success(trans('visiosoft.module.advs::field.extended'));
return $this->redirect->to('admin/advs/advs');
}
}