mirror of
https://github.com/openclassify/openclassify.git
synced 2026-02-11 07:46:07 -06:00
fix add remove error
This commit is contained in:
parent
d9c3d34118
commit
7429db5768
@ -22,4 +22,5 @@ return [
|
|||||||
'currency_converted' => 'Currency Converted Successfully.',
|
'currency_converted' => 'Currency Converted Successfully.',
|
||||||
'choose_user' => 'Choose a user',
|
'choose_user' => 'Choose a user',
|
||||||
'owner_updated_successfully' => 'The Owner Has Been Updated Successfully!',
|
'owner_updated_successfully' => 'The Owner Has Been Updated Successfully!',
|
||||||
|
'no_add_found' => 'No Ad Found!',
|
||||||
];
|
];
|
||||||
|
|||||||
@ -340,12 +340,6 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
|
|||||||
$adv->update(['cover_photo' => $coverPhoto]);
|
$adv->update(['cover_photo' => $coverPhoto]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function delete_empty_advs()
|
|
||||||
{
|
|
||||||
AdvsAdvsEntryModel::query()->where('slug', "")->forceDelete();
|
|
||||||
DB::table('advs_advs_translations')->where('name', NULL)->delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getRecommendedAds($id)
|
public function getRecommendedAds($id)
|
||||||
{
|
{
|
||||||
return AdvModel::query()
|
return AdvModel::query()
|
||||||
@ -364,7 +358,9 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
|
|||||||
|
|
||||||
public function getAdvArray($id)
|
public function getAdvArray($id)
|
||||||
{
|
{
|
||||||
return AdvsAdvsEntryModel::query()->where('advs_advs.id', $id)->first()->toArray();
|
$ad = AdvsAdvsEntryModel::query()->where('advs_advs.id', $id)->first();
|
||||||
|
|
||||||
|
return ($ad !== null) ? $ad->toArray() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getQuantity($quantity, $type, $item)
|
public function getQuantity($quantity, $type, $item)
|
||||||
|
|||||||
@ -20,8 +20,6 @@ interface AdvRepositoryInterface extends EntryRepositoryInterface
|
|||||||
|
|
||||||
public function cover_image_update($adv);
|
public function cover_image_update($adv);
|
||||||
|
|
||||||
public function delete_empty_advs();
|
|
||||||
|
|
||||||
public function getRecommendedAds($id);
|
public function getRecommendedAds($id);
|
||||||
|
|
||||||
public function getLastAd($id);
|
public function getLastAd($id);
|
||||||
|
|||||||
@ -568,8 +568,7 @@ class AdvsController extends PublicController
|
|||||||
|
|
||||||
if ($advModel->is_enabled('packages') and $adv->slug == "") {
|
if ($advModel->is_enabled('packages') and $adv->slug == "") {
|
||||||
$cat = app('Visiosoft\PackagesModule\Http\Controller\PackageFEController')->AdLimitForNewAd($request);
|
$cat = app('Visiosoft\PackagesModule\Http\Controller\PackageFEController')->AdLimitForNewAd($request);
|
||||||
if(!is_null($cat))
|
if (!is_null($cat)) {
|
||||||
{
|
|
||||||
return redirect('/');
|
return redirect('/');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -695,6 +694,11 @@ class AdvsController extends PublicController
|
|||||||
$isActive = new AdvModel();
|
$isActive = new AdvModel();
|
||||||
$adv = $advRepository->getAdvArray($id);
|
$adv = $advRepository->getAdvArray($id);
|
||||||
|
|
||||||
|
if (is_null($adv)) {
|
||||||
|
$this->messages->error(trans('visiosoft.module.advs::message.no_add_found'));
|
||||||
|
return $this->redirect->to(route('advs::create_adv'));
|
||||||
|
}
|
||||||
|
|
||||||
if ($adv['created_by_id'] != auth()->id()
|
if ($adv['created_by_id'] != auth()->id()
|
||||||
&& !auth()->user()->hasPermission('visiosoft.module.advs::advs.write')) {
|
&& !auth()->user()->hasPermission('visiosoft.module.advs::advs.write')) {
|
||||||
abort(403);
|
abort(403);
|
||||||
|
|||||||
@ -50,9 +50,6 @@ class MyProfileController extends PublicController
|
|||||||
|
|
||||||
public function home(ProfileFormBuilder $form, AdvRepositoryInterface $advRepository)
|
public function home(ProfileFormBuilder $form, AdvRepositoryInterface $advRepository)
|
||||||
{
|
{
|
||||||
//clear empty ads
|
|
||||||
$advRepository->delete_empty_advs();
|
|
||||||
|
|
||||||
$advs_count = new AdvModel();
|
$advs_count = new AdvModel();
|
||||||
$advs_count = count($advs_count->myAdvsByUser()->get());
|
$advs_count = count($advs_count->myAdvsByUser()->get());
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user