我有购物车的服务提供商和我的班级。
这是我的服务提供商:
<?php
namespace Alexxosipov\Cart;
use Illuminate\Support\ServiceProvider;
use Alexxosipov\Cart\Cart as Cart;
class CartServiceProvider extends ServiceProvider {
public function boot() {
}
public function register() {
$this->app->singleton('cart', function() {
return new Cart;
});
}
}
但我的phpstorm告诉我,use Alexxosipov\Cart\Cart as Cart;
从未在代码中使用过。我哪里做错了?
答案 0 :(得分:1)
根据laravel documentation,你需要输入提示界面:
<?php
namespace Alexxosipov\Cart;
use Illuminate\Support\ServiceProvider;
use Alexxosipov\Cart\Cart as Cart;
class CartServiceProvider extends ServiceProvider {
public function boot() {
}
public function register() {
$this->app->singleton(Cart::class, function() {
return new Cart;
});
}
}