Merge pull request #29 from openclassify/vedat

Package model does not exist fix
This commit is contained in:
Fatih Alp 2019-07-08 14:02:36 +03:00 committed by GitHub
commit e9819be6df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -123,14 +123,13 @@ class AdvsController extends PublicController
Cookie::queue(Cookie::make('last_search', $request->getRequestUri(), 84000)); Cookie::queue(Cookie::make('last_search', $request->getRequestUri(), 84000));
$viewType = $request->cookie('viewType'); $viewType = $request->cookie('viewType');
if (isset($viewType) and $viewType == 'table') { if (isset($viewType) and $viewType == 'table') {
return $this->view->make('visiosoft.module.advs::advs/table', $compact); return $this->view->make('visiosoft.module.advs::advs/table', $compact);
} elseif (isset($viewType) and $viewType == 'map') } elseif (isset($viewType) and $viewType == 'map') {
{ return $this->view->make('visiosoft.module.advs::advs/map', $compact);
return $this->view->make('visiosoft.module.advs::advs/map', $compact); }
} return $this->view->make('visiosoft.module.advs::advs/list', $compact);
return $this->view->make('visiosoft.module.advs::advs/list', $compact);
} }
public function viewType($type) public function viewType($type)
@ -316,7 +315,6 @@ class AdvsController extends PublicController
Dispatcher $events, Dispatcher $events,
AdvModel $advModel, AdvModel $advModel,
CategoryModel $categoryModel, CategoryModel $categoryModel,
PackageModel $packageModel,
AdModel $StoreAdModel AdModel $StoreAdModel
) )
{ {
@ -335,6 +333,7 @@ class AdvsController extends PublicController
if ($advModel->is_enabled('packages') and $adv->slug == "") { if ($advModel->is_enabled('packages') and $adv->slug == "") {
$parent_cat = $categoryModel->getParentCats($request->cat1, 'parent_id'); $parent_cat = $categoryModel->getParentCats($request->cat1, 'parent_id');
$packageModel = new PackageModel();
$package = $packageModel->reduceLimit($parent_cat, 'reduce'); $package = $packageModel->reduceLimit($parent_cat, 'reduce');
if ($package != null) { if ($package != null) {
return redirect('/')->with('error', trans('visiosoft.module.advs::message.please_buy_package')); return redirect('/')->with('error', trans('visiosoft.module.advs::message.please_buy_package'));
@ -342,7 +341,7 @@ class AdvsController extends PublicController
} }
if ($advModel->is_enabled('store') and $adv->slug == "") { if ($advModel->is_enabled('store') and $adv->slug == "") {
if ($request->store != "0" and $request->store != null ) { if ($request->store != "0" and $request->store != null) {
$StoreAdModel->createStoreAdLoggedInUser($request->store, $request->update_id); $StoreAdModel->createStoreAdLoggedInUser($request->store, $request->update_id);
} }
} }
@ -568,7 +567,7 @@ class AdvsController extends PublicController
} }
public function statusAds($id, $type, SettingRepositoryInterface $settings, Dispatcher $events, AdvModel $advModel, PackageModel $packageModel) public function statusAds($id, $type, SettingRepositoryInterface $settings, Dispatcher $events, AdvModel $advModel)
{ {
$ad = $advModel->getAdv($id); $ad = $advModel->getAdv($id);
$auto_approved = $settings->value('visiosoft.module.advs::auto_approve'); $auto_approved = $settings->value('visiosoft.module.advs::auto_approve');
@ -582,6 +581,7 @@ class AdvsController extends PublicController
$advModel->publish_at_Ads($id); $advModel->publish_at_Ads($id);
if ($ad->finish_at == NULL AND $type == "approved") { if ($ad->finish_at == NULL AND $type == "approved") {
if ($advModel->is_enabled('packages')) { if ($advModel->is_enabled('packages')) {
$packageModel = new PackageModel();
$published_time = $packageModel->reduceTimeLimit($ad->cat1); $published_time = $packageModel->reduceTimeLimit($ad->cat1);
if ($published_time != null) { if ($published_time != null) {
$default_published_time = $published_time; $default_published_time = $published_time;