Using Laravel 4, I currently have an area for all of my repositories, and then I bind these repositories to an interface to use. This is all currently working and I access these in my controllers using the standard $this->users->find(1)
method.
In my User repository, I have my assignRole (attach) and removeRole (detach) methods which I took my my model/User.php
class. Okay great, but now I try to run my seeds it uses the eloquent classes, e.g. User::create();
.
Question 1: Are my seed files also supposed to also use the repository pattern? I have no experience with say Mongo, but would I also seed the database the same way if I were going to switch?
Question 2: My Auth
driver currently uses eloquent... so what if I also changed this? Should I be making a repository for my auth and implement things like $this->auth->login($user)
.
Really I'm confused as to when I should be implementing a repository interface. artisan migrate
runs the seed files, which currently create a MySQL DB, what would happen if I wanted to use Mongo or a NoSQL DB?