Skip to content
Advertisement

Pass variable to view via controller in Laravel

I need help with passing the variable I have initialized using __construct() to view in Laravel.

Here is my controller code

JavaScript

I get an error undefined variable profileInfo

Advertisement

Answer

When using compact() the parameters used must be defined as variables:

JavaScript

In this case compact() will create an array like this:

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