Hey DrPrez,
What I mean is, that the categories shown will be the same, but the content of each category will be different for each country.
Makes sense?
Thanks man, ill give it a go! Otherwise ill get back here :)
I have now set up my migrations as well as my relationships in the various models. The structure is as follows:
Cities
Categories
Products
Querying works as expected, however my problem is that I cannot wrap my head around showing all the categories and populate them with data according to the specific city.
Down below is what i've tried so far, which is essentially just a duplicate of some other code which I use to display my categories with products.
... // CitiesController
public function getCity($city_id) {
return View::make('cities.category')
->with('categories', Category::where('city_id', '=', $city_id)->paginate(6))
->with('cities', City::find($city_id));
}
// cities.category view
@extends('layouts.default')
@section('content')
<h1>Cities</h1>
@foreach($citynav as $city)
<li>{{ HTML::link('/cities/category/'.$city->id, $city->name) }}</li>
@endforeach
@stop
I'm not even sure this would yield me the desired result (if it worked), since this would probably return all the categories with all of the products, regardless which city is chosen?
Can anyone help me here? :)
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community