Well, in my view I've a foreach and I display the id of a product with {{$look->item1_id}} but i need the name, so I need to look to another table to look the name, but how?
I have a little store where some items create different "looks".
My db looks like this:
items table:
id/item_name/other_fields
looks table:
id/look_name/item1_id/item2_id/item3_id
my controller looks like:
$looks=Look::where('gender', '=', "girls")->get();
return View::make('store')->with('looks', $looks)
So in my view:
@foreach ($looks as $looks)
Id: {{$looks->item1_id}}
Name: ??
@endforeach
My model:
class Look extends Eloquent
{
protected $table='looks';
}
class Item extends Eloquent
{
protected $table='items';
}
I know with Eloquent Relationships could be done, but I cannot change the db.
Thanks