DEV Community

Discussion on: Auto-generated Repository Pattern in Laravel

 
ngodinhcuong profile image
Ngo Dinh Cuong

Thank you :)!
Laravel allows you binding Interfaces To Implementations. This means lara-repository already do it for you.
\App\Repositories\Staff\StaffInterface::class => \App\Repositories\Staff\StaffRepository::class,
lara-repository injects the StaffRepository when a class needs an implementation of StaffInterface.