i want to get all row by all() and into foreach i want to get fields of other table in query builder.
$getResult = webLinks::all();
$result = array();
foreach ($getResult as $value)
{
$query = DB::table('webInformation')
->where('webLink', '=', $value->id)
->get();
$r['site'] = $value->webLink;
$r['webLink'] = $query->webLink; //I GET ERROR
$result[] = $r;
}
in this coomand i can not save webLink of webInformation table into array.
i'm try this:
$r['webLink'] = $query->webLink;
or
$r['webLink'] = $query['webLink'];
how to fix this problem?
Result of that :
Array
(
[0] => stdClass Object
(
[id] => 2
[webLink] => 1
[updated_at] => 2014-03-13 10:20:16
[created_at] => 2014-03-13 10:20:16
)
[1] => stdClass Object
(
[id] => 3
[webLink] => 1
[updated_at] => 2014-03-13 10:25:32
[created_at] => 2014-03-13 10:25:32
)
)