mirror of
https://github.com/openclassify/openclassify.git
synced 2026-03-09 09:45:26 -05:00
#2340 Packages module changes - ad post (e-madencilik)
This commit is contained in:
parent
0749b73526
commit
22d9267588
@ -447,4 +447,16 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
|
||||
->orderBy('count_show_ad', 'desc')
|
||||
->paginate(setting_value('visiosoft.module.advs::popular_ads_limit', setting_value('streams::per_page')));
|
||||
}
|
||||
|
||||
public function approveAds($adsIDs)
|
||||
{
|
||||
$defaultAdPublishTime = setting_value('visiosoft.module.advs::default_published_time');
|
||||
$ads = $this->newQuery()->where('advs_advs.id', $adsIDs)->update([
|
||||
'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')
|
||||
]);
|
||||
|
||||
return $ads;
|
||||
}
|
||||
}
|
||||
|
||||
@ -44,4 +44,6 @@ interface AdvRepositoryInterface extends EntryRepositoryInterface
|
||||
public function getByUsersIDs($usersIDs);
|
||||
|
||||
public function getPopular();
|
||||
|
||||
public function approveAds($adsIDs);
|
||||
}
|
||||
|
||||
@ -672,10 +672,15 @@ class AdvsController extends PublicController
|
||||
/* Update Adv */
|
||||
$adv = AdvsAdvsEntryModel::find($request->update_id);
|
||||
|
||||
$allowPendingAdCreation = false;
|
||||
if ($advModel->is_enabled('packages') and $adv->slug == "") {
|
||||
$cat = app('Visiosoft\PackagesModule\Http\Controller\PackageFEController')->AdLimitForNewAd($request);
|
||||
if (!is_null($cat)) {
|
||||
return redirect('/');
|
||||
if (is_array($cat) && array_key_exists('allowPendingAds', $cat)) {
|
||||
$allowPendingAdCreation = $cat['allowPendingAds'];
|
||||
} else {
|
||||
return redirect('/');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -730,7 +735,7 @@ class AdvsController extends PublicController
|
||||
}
|
||||
|
||||
// Auto approve
|
||||
if (setting_value('visiosoft.module.advs::auto_approve')) {
|
||||
if (setting_value('visiosoft.module.advs::auto_approve') && !$allowPendingAdCreation) {
|
||||
$defaultAdPublishTime = setting_value('visiosoft.module.advs::default_published_time');
|
||||
$adv->update([
|
||||
'status' => 'approved',
|
||||
@ -775,7 +780,11 @@ class AdvsController extends PublicController
|
||||
return redirect('/advs/edit_advs/' . $request->update_id)->with('cats_d', $cats_d)->with('request', $request);
|
||||
}
|
||||
event(new CreatedAd($adv));
|
||||
return redirect(route('advs_preview', [$request->update_id]));
|
||||
if ($allowPendingAdCreation) {
|
||||
return redirect(route("visiosoft.module.packages::buy_package") . '?ad_id=' . $adv->id);
|
||||
} else {
|
||||
return redirect(route('advs_preview', [$request->update_id]));
|
||||
}
|
||||
}
|
||||
|
||||
/* New Create Adv */
|
||||
|
||||
Loading…
Reference in New Issue
Block a user