这可以正常工作,但是我删除了一些未使用的类,现在laravel的自动装配功能无法解决类型提示的依赖关系。
我在AppServiceProvider.php
中声明了服务类的各种绑定,这些依赖关系应通过自动装配来解决,但没有。
我留下一个示例代码AppServiceProvider.php
和一个类ProductoService.php
我在这里想念的是什么?预先感谢!
错误
类型错误:函数参数太少 App \ Services \ ProductoService :: __ construct(),传入0 /home/eznb/Documentos/osiris/app/Providers/AppServiceProvider.php 第44行,恰好是1个
AppServiceProvider.php
namespace App\Providers;
use App\Services\CajaService;
use App\Services\PrecioService;
use App\Services\ProductoService;
use App\Services\ServicioService;
use App\Services\TrabajoService;
use App\Services\TurnoService;
use Calendar;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
//
view()->composer('*',function ($view) {
$event_list = [];
$calendar_details = Calendar::addEvents($event_list);
$view->with('calendar_details',$calendar_details);
});
}
/**
* Register any application services.
*
* @return void
*/
public function register()
{
$this->app->bind(PrecioService::class,function ($app) {
return new PrecioService();
});
$this->app->bind(ProductoService::class,function ($app) {
return new ProductoService();
});
$this->app->bind(ServicioService::class,function ($app) {
return new ServicioService();
});
$this->app->bind(CajaService::class,function ($app) {
return new CajaService();
});
$this->app->bind(TrabajoService::class,function ($app) {
return new TrabajoService();
});
$this->app->bind(TurnoService::class,function ($app) {
return new TurnoService();
});
}
}
ProductoService.php
namespace App\Services;
use App\Producto;
use App\Services\PrecioService;
class ProductoService
{
protected $precio_service;
public function __construct(PrecioService $precio_service)
{
$this->precio_service = $precio_service;
}
.
.
.
some more core
.
.
.