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

guywade's avatar

[Solved] Service Provider not loading (Laravel 5.2)

I'm trying to send data to a partial view. It works if I put it in the boot function of AppServiceProvider, but I've created a new service provider, put the same code in it and added the provider in the config/app.php file and I get an undefined variable error.

Looking in the bootstrap/cache/services.php file, I can't see my new provider.

I'm following the "When You Want a View Partial to Always Receive Data" video, but I'm wondering if something has changed since that video was made?

Any help gratefully received.

0 likes
2 replies
jimmck's avatar

@guywade Got to post the first part of the stack trace. Show the service provider entry app.php file. You got the boot function down. Place to start when you want to hook something in at startup. Put your code in between backticks

Your stuff goes here
guywade's avatar

Having read through the comments under the video again, I found I needed to "php artisan config:clear"

All working now.

1 like

Please or to participate in this conversation.