radic - 2 months ago

$menu = MenuModel::with('links')->find(1)->toArray();
$menu['links']; // should be an array 

This does not happen with EntryModels. I think it has to do with the $cascades property but haven't digged to deep into it.

How can i ensure that toArray() does include the loaded relationships?

ryanthompson - 2 months ago

Ah good catch! Seems I remember a discussion if Laravel was gonna do toArrayWithRelations or use loaded :-P

Either way - I've update our base model with the laravel one in that regard (Streams Platform v1.3.153). Composer update!

ryanthompson - 2 months ago

Bah.. there is recursion issue in here. I've reverted and will need to clean up later :-/

ryanthompson - 2 months ago

Ok fixed - and pushed.

radic - 2 months ago

That was quick! Thanks a lot man.

ryanthompson - 2 months ago

I've had to change this to toArrayWithRelations because it was causing weird issues here and there because of it's nested array and Laravel utilities not handling it correctly.