Support the ongoing development of Laravel.io →
Laravel

Hi All, hoping someone can help me,

I am updating from version 5.7 to 5.8 and i am now having issues with our repository setup.

I am using the repository pattern, for each repository we have a contract. I have a service provider (this is setup to be deferred) to bind the contracts to the repositories so when type hinted the interfaces / contracts in the controllers the repository is injected in .

We also have a service provider (also setup to be deferred) that when the repository is resolved it gets some config data from a config file and calls methods on the repository to setup attributes.

This all worked great on 5.7 but after upgrading to 5.8 it doesn't. If i switch the controllers to type hint the repository instead of the contract it works, but obviously if / when we change the repository we would have to amend all places this is referenced, completely against purpose of coding to an interface and injecting this.

Hopefully i've explained that well enough!

Has anyone come up against this or similar? I've checked the upgrade notes and 5.8 no longer uses the defer property as it implements the interface which i am doing but i can't see anything else and i am struggling to debug it any further.

https://laravel.com/docs/5.8/upgrade#deferred-service-providers

Any help any one can offer would be great.

Thanks Jamie

Last updated 3 years ago.
0

In reply no myself, seems if i run

php artisan cache:clear && php artisan clear-compiled && php artisan optimize:clear

and then change the provider to be not be deferred it works fine, as soon as i set it to be deferred and run the above command again it stops working

Very strange!!

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.