In laravel i get this type of array from where query. i want to get only those menu where parent is 0;
$memus = Menu::where('parent', 0)->get()->toArray();
Array
(
[0] => Array
(
[id] => 13
[name] => Movies
[parent] => 0
[deleted_at] =>
[created_at] => 2015-04-07 02:48:48
[updated_at] => 2015-04-07 02:48:48
)
[1] => Array
(
[id] => 16
[name] => zxcvxc
[parent] => 0
[deleted_at] =>
[created_at] => 2015-04-07 02:53:26
[updated_at] => 2015-04-07 03:03:39
)
[2] => Array
(
[id] => 17
[name] => alsdkf
[parent] => 0
[deleted_at] =>
[created_at] => 2015-04-07 02:53:41
[updated_at] => 2015-04-07 03:02:04
)
)
So how to get particular value from this array
i have tried echo $abc->name and echo $abc->id
but not access
foreachloop and you have to get it as array as$menu['name']or if you want to use it as object then don't convert the result usingtoArray()then you can fetch it as$menu->name.