#2817 slug error fixed

This commit is contained in:
Muammer Top 2020-12-07 09:34:57 +03:00
parent e9f3ec232b
commit 8275be050a
2 changed files with 10 additions and 6 deletions

View File

@ -216,8 +216,15 @@ class AdvModel extends AdvsAdvsEntryModel implements AdvInterface
public function getAdvDetailLinkByModel($object, $type = null)
{
$id = $object->id;
$seo = str_slug($object->slug, '-');
if ($type != null) {
$id = $object->id;
$seo = str_slug($object->name);
$seo = str_replace('_', '-', $seo);
return \route('adv_detail_seo', [$seo, $id]);
}
$id = $object->getObject()->id;
$seo = str_slug($object->getObject()->name);
$seo = str_replace('_', '-', $seo);
return \route('adv_detail_seo', [$seo, $id]);
}

View File

@ -581,10 +581,7 @@ class AdvsController extends PublicController
$configurations = $this->optionConfigurationRepository->getConf($adv->id);
if (Str::slug($adv->slug, '-') != $seo) {
$this->messages->error(trans('visiosoft.module.advs::message.ad_doesnt_exist'));
return redirect()->route('visiosoft.module.advs::list');
} else if ($adv->created_by_id == isset(auth()->user()->id) or $adv->status == "approved") {
if ($adv->created_by_id == isset(auth()->user()->id) or $adv->status == "approved") {
return $this->view->make('visiosoft.module.advs::ad-detail/detail', compact('adv', 'complaints',
'recommended_advs', 'categories', 'features', 'options', 'configurations'));
} else {