Answer the question
In order to leave comments, you need to log in
Is it possible to use dependency type-hint for migrations in laravel5?
Let's say I want to register a user right after I create a table for him in the database.
By default, this is done in laraver5 by a certain Registrar service provider.
Is it possible to make a beautiful type-hint to use the Registrar, and how can you get the ServiceProvider in the migration in general? Tried doing this, but it didn't work:$registrar = $this->app->make('Registrar');
Answer the question
In order to leave comments, you need to log in
1. Creating users in migrations is bad manners, there are seeds for this . Rethought: you need to fill the database with working data either through migrations or through console commands .
2. You don't see the difference between a service provider and just a class, which is what Registrar is.
3. Open the code for this class and see how it looks. Then read the documentation . See the usage example in the controllers of the base application.
PS In Laravel 5.1, the Registrar service class is no longer available.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question