Skip to content
Advertisement

Undefined Array Key “”

I am new to laravel so this particular error is giving me headache. I am trying use a datatable in laravel vue.js app. I have the following code in my laravel backend and when I try retrieving the data from the data, I get the Undefined array key error message in the dev tools. How do I resolve the issue please? Your help would be greatly appreciated.

JavaScript

Below is the stacktrace

JavaScript

Advertisement

Answer

The issue is that you’re trying to get an element from your array $columns with an empty string.

JavaScript

You can fix the issue by setting a default value

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