mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-24 22:11:01 -06:00
Merge pull request #154 from openclassify/dia
Improvements of SEO link structure like Vebze #74
This commit is contained in:
commit
fb7f802d81
@ -228,12 +228,12 @@ class AdvModel extends AdvsAdvsEntryModel implements AdvInterface
|
|||||||
$id = $object->id;
|
$id = $object->id;
|
||||||
$seo = str_slug($object->name);
|
$seo = str_slug($object->name);
|
||||||
$seo = str_replace('_', '-', $seo);
|
$seo = str_replace('_', '-', $seo);
|
||||||
return \route('adv_detail_seo', [$id, $seo]);
|
return \route('adv_detail_seo', [$seo, $id]);
|
||||||
}
|
}
|
||||||
$id = $object->getObject()->id;
|
$id = $object->getObject()->id;
|
||||||
$seo = str_slug($object->getObject()->name);
|
$seo = str_slug($object->getObject()->name);
|
||||||
$seo = str_replace('_', '-', $seo);
|
$seo = str_replace('_', '-', $seo);
|
||||||
return \route('adv_detail_seo', [$id, $seo]);
|
return \route('adv_detail_seo', [$seo, $id]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getAdvDetailLinkByAdId($id)
|
public function getAdvDetailLinkByAdId($id)
|
||||||
@ -243,7 +243,7 @@ class AdvModel extends AdvsAdvsEntryModel implements AdvInterface
|
|||||||
$id = $adv->id;
|
$id = $adv->id;
|
||||||
$seo = str_slug($adv->name);
|
$seo = str_slug($adv->name);
|
||||||
$seo = str_replace('_', '-', $seo);
|
$seo = str_replace('_', '-', $seo);
|
||||||
return \route('adv_detail_seo', [$id, $seo]);
|
return \route('adv_detail_seo', [$seo, $id]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -118,12 +118,20 @@ class AdvsModuleServiceProvider extends AddonServiceProvider
|
|||||||
'as' => 'adv_detail_seo',
|
'as' => 'adv_detail_seo',
|
||||||
'uses' => 'Visiosoft\AdvsModule\Http\Controller\advsController@view'
|
'uses' => 'Visiosoft\AdvsModule\Http\Controller\advsController@view'
|
||||||
],
|
],
|
||||||
|
'ad/{id}' => [
|
||||||
|
'as' => 'adv_detail',
|
||||||
|
'uses' => 'Visiosoft\AdvsModule\Http\Controller\advsController@view'
|
||||||
|
],
|
||||||
|
'ad/{seo}/{id}' => [
|
||||||
|
'as' => 'adv_detail_seo',
|
||||||
|
'uses' => 'Visiosoft\AdvsModule\Http\Controller\advsController@view'
|
||||||
|
],
|
||||||
'advs/map?country={country}&city[]={city}&district={districts}' => [
|
'advs/map?country={country}&city[]={city}&district={districts}' => [
|
||||||
'as' => 'visiosoft.module.advs::show_ad_map_location',
|
'as' => 'visiosoft.module.advs::show_ad_map_location',
|
||||||
'uses' => 'Visiosoft\AdvsModule\Http\Controller\advsController@map'
|
'uses' => 'Visiosoft\AdvsModule\Http\Controller\advsController@map'
|
||||||
],
|
],
|
||||||
'advs/categories' => 'Visiosoft\AdvsModule\Http\Controller\CategoriesController@index',
|
'advs/categories' => 'Visiosoft\AdvsModule\Http\Controller\CategoriesController@index',
|
||||||
'advs/categories/{cat}' => 'Visiosoft\AdvsModule\Http\Controller\CategoriesController@listByCat',
|
'advs/c/{cat}' => 'Visiosoft\AdvsModule\Http\Controller\CategoriesController@listByCat',
|
||||||
'advs/module_active' => 'Visiosoft\AdvsModule\Http\Controller\advsController@index',
|
'advs/module_active' => 'Visiosoft\AdvsModule\Http\Controller\advsController@index',
|
||||||
'advs/create_adv' => [
|
'advs/create_adv' => [
|
||||||
'as' => "create_adv",
|
'as' => "create_adv",
|
||||||
|
|||||||
@ -8,12 +8,24 @@ class CategoriesController extends PublicController {
|
|||||||
|
|
||||||
public function listByCat($cat) {
|
public function listByCat($cat) {
|
||||||
$advs = DB::table('advs_advs')
|
$advs = DB::table('advs_advs')
|
||||||
->where('category_id', $cat)
|
->where('cat1', $cat)
|
||||||
|
->orwhere('cat2', $cat)
|
||||||
|
->orwhere('cat3', $cat)
|
||||||
|
->orwhere('cat4', $cat)
|
||||||
|
->orwhere('cat5', $cat)
|
||||||
|
->orwhere('cat6', $cat)
|
||||||
|
->orwhere('cat7', $cat)
|
||||||
->leftJoin('users_users as u1', 'advs_advs.created_by_id', '=', 'u1.id')
|
->leftJoin('users_users as u1', 'advs_advs.created_by_id', '=', 'u1.id')
|
||||||
->leftJoin('advs_advs_translations as t1', 'advs_advs.id', '=', 't1.id')
|
->leftJoin('advs_advs_translations as t1', 'advs_advs.id', '=', 't1.id')
|
||||||
->select('advs_advs.*','u1.username as owner', 't1.name as name')
|
->select('advs_advs.*','u1.username as owner', 't1.name as name')
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
|
foreach ($advs as $adv) {
|
||||||
|
if (strpos($adv->cover_photo, 'http') !== 0 && strpos($adv->cover_photo, '/') !== 0) {
|
||||||
|
$adv->cover_photo = "/$adv->cover_photo";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $this->view->make('visiosoft.module.advs::list/list', compact('advs'));
|
return $this->view->make('visiosoft.module.advs::list/list', compact('advs'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -245,8 +245,10 @@ class AdvsController extends PublicController
|
|||||||
return redirect($this->request->headers->get('referer'));
|
return redirect($this->request->headers->get('referer'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function view($id)
|
public function view($seo, $id = null)
|
||||||
{
|
{
|
||||||
|
$id = is_null($id) ? $seo : $id;
|
||||||
|
|
||||||
$categories = array();
|
$categories = array();
|
||||||
$categories_id = array();
|
$categories_id = array();
|
||||||
$isActiveComplaints = $this->adv_model->is_enabled('complaints');
|
$isActiveComplaints = $this->adv_model->is_enabled('complaints');
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user