laravel service 使用问题1

在对应controller调用service时,例如testController中调用testService,$this->test->调用的方法。 调用其他service时,需要new一个,当
/** * 注入Test对象实例 */ public function __construct(Test $test) { $this->test= $test; }
构造函数中实例化一个test对象时,需要在引用时new TestService(Test test)。没有实例对象是,直接new TestService()就可。

赵鹏磊

hello world

云端