Reputation: 1234
I got the service provider and my class for shopping cart.
This is my service provider:
<?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;
});
}
}
but my phpstorm says me, that use Alexxosipov\Cart\Cart as Cart;
is never used in code. Where did I go wrong?
Upvotes: 0
Views: 39
Reputation: 1056
According to laravel documentation, you need to type hint the Cart interface:
<?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;
});
}
}
Upvotes: 1