DEV Community

Tr.Ra
Tr.Ra

Posted on

use laravel repository class without __contruct

If you want Laravel to solve your dependencies, you must build your object with App::make instead of instanciate manually with new.

$myInstance = App::make('App\Repositories\CartRepository');

just in case you want to test in artisan tinker

Top comments (0)

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay