I am trying to get through the complex eloquent relationships / attributes of a model, and I would like to use a simple point structure to iterate it, similar to how you can move arrays using Arr::get()
Example:
$data = [ 'foo' => [ 'bar' => [ 'key' => 'value' ] ] ]; $value = Arr::get($data, 'foo.bar.key');
I tried using
$value = Arr::get($model, 'relation.subrelation.attribute')
However, this fails, and aways returns null, although the eloquent models support ArrayAccess.
Does laravel have an easy way to do this?
source share