You might want to check my previous post about php interface before proceeding. https://josafebalili.com/posts/php-interface/

Let's create a repository interface for the post. Let's call it PostRepositoryInterface.php. As you can see, this repository class implemented our PostRepository that we created .

https://photos.app.goo.gl/jEVhZ882N6mgSfpk7

Now, we need to create RepositoryServiceProvider and bind PostRepositoryInterface.



Then register it to the AppServiceProvider.

https://github.com/jsafe00/laravel-service-repository/tree/with-interface

Check the Eloquent Interface implementation at https://josafebalili.com/posts/implement-crud-with-laravel-service-repository-pattern-(with-eloquent-interface)/