Laravel custom service, how to inject dependencies?
我想大声告诉你
我想大声告诉你 2017-05-16 16:53:06
0
1
523
  1. A custom service has been established through ServiceContainer and ServiceProvider. How to use dependency injection in the service, such as Request, User, Cookie, etc.

If you write User $user directly in the service method, the prompt is as follows:

Argument 1 passed to App\Services\UserService::register() must be an instance of App\User, none given, called in /home/vagrant/Code/zhicheauto/car-server/app/Api /Controllers/UsersController.php on line 32 and defined

我想大声告诉你
我想大声告诉你

reply all(1)
迷茫

Not introduced?
use AppUser

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template