Skip to content
Advertisement

Undefined index , Unable to fetch columns- Laravel

JavaScript

In the above code, Notifications is the model Name. Getting the error Undefined index: notificationTypeName when trying to access column notificationTypeName of the array $data.

dd($data) gives an ouput as below:

JavaScript

Advertisement

Answer

The all method returns the underlying array represented by the collection:

see this : https://laravel.com/docs/8.x/collections#method-all

so try with this:

JavaScript

with foreach

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement