Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

jsprabowo's avatar

Laravel 7 Component Error When Deployed into Ubuntu Server

Hi All, I have an issue about laravel 7 component, I'm used component to show my sidebar menus in a dashboard app, in my local it's not error, but when I deployed into server, I got error like this

Undefined variable: parent_menus (View: /var/www/akn_cms/agrokimiacms/resources/views/components/sidebar.blade.php)

I've update the php version in server bevame PHP 7.3.15

Anyone can help me please? Thanks

Regards, Juang

0 likes
6 replies
camilovietnam's avatar

Could you upload this sidebar.blade.php file somewhere? It seems there is a variable called $parent_menus that is being required, but is not being defined. What is this variable?

camilovietnam's avatar

Where are you initializing $parent_menus? When do you assign a value to this variable?

camilovietnam's avatar

I'm not entirely familiar with Laravel 7. I'd say you could try going back in the call stack, finding out where exactly you do something like $parent_menus = … and then giving it a new value, testing to see if that fixes the issue. If it does, then I would try to figure out what is the value that Laravel is assigning to the variable, in the method you shared https://www.codepile.net/pile/jk3EJv6W I see a public function parent_menus(), is the return value null? I would try to debug this function, check the value of $data right before the return $data, just to see what it is returning.

Please or to participate in this conversation.