Hey guys! Just thought I would get back and thank you all for helping me solve this issue, it surely has caused a lot of headache over the past few days for me, but it seems that with your help I am there 95% now :).
I have one last issue. Right now the listings shown are dependent on the city_id and the subcategory_id.
How do I make it so that it also depends on the category_name in the query?
My route is:
Route::get('/annoncer/{city_id}/{category_name}/{subcategory_id}', [
'as' => 'searchbycat',
'uses' => 'ListingsController@showBySubCat']
);
My function:
public function showBySubCat($city_id, $category_name, $subcategory_id) {
$category = Category::wherename($category_name)->firstOrFail();
$listings = Listing::where('city_id', '=', $city_id)
->where('subcategory_id', '=', $subcategory_id)
->get();
return View::make('cities.cities-view', compact('categories', 'listings'));
}
/annoncer/7100/Shopping/3 <- is what is being produced now.
Ideally it should be /annoncer/7100/Shopping/(name_of_subcategory) - and it should be dependent on the category_name as well as the others (which works right now).
Hope it makes sense, and thanks again! :)