diff --git a/src/Drivers/Driver.php b/src/Drivers/Driver.php index ada3c73..72b82a9 100644 --- a/src/Drivers/Driver.php +++ b/src/Drivers/Driver.php @@ -6,7 +6,7 @@ interface Driver { - public function storeItem(Model|array $item, int|null $userId = null): Driver; + public function storeItem(Model|array $item, ?int $userId = null): Driver; public function storeItems(array $items): Driver; diff --git a/src/Drivers/LaravelCartDatabase.php b/src/Drivers/LaravelCartDatabase.php index 56e6c6f..28c2fc3 100644 --- a/src/Drivers/LaravelCartDatabase.php +++ b/src/Drivers/LaravelCartDatabase.php @@ -10,7 +10,7 @@ class LaravelCartDatabase implements Driver /** * Store item in cart. */ - public function storeItem(Model|array $item, int|null $userId = null): static + public function storeItem(Model|array $item, ?int $userId = null): static { if (is_null($userId)) { $userId = auth()->id(); diff --git a/src/LaravelCart.php b/src/LaravelCart.php index efafa82..2b0b7dc 100644 --- a/src/LaravelCart.php +++ b/src/LaravelCart.php @@ -12,7 +12,6 @@ * @method static \Binafy\LaravelCart\Drivers\Driver decreaseQuantity(\Illuminate\Database\Eloquent\Model $item, int $quantity = 1) * @method static \Binafy\LaravelCart\Drivers\Driver removeItem(\Illuminate\Database\Eloquent\Model $item) * @method static \Binafy\LaravelCart\Drivers\Driver emptyCart() - * * @method static string getDefaultDriver() * @method static void setDefaultDriver(string $name) * diff --git a/tests/Feature/Manager/Database/CartDeleteTest.php b/tests/Feature/Manager/Database/CartDeleteTest.php index 3d658d8..86227d1 100644 --- a/tests/Feature/Manager/Database/CartDeleteTest.php +++ b/tests/Feature/Manager/Database/CartDeleteTest.php @@ -5,6 +5,7 @@ use Illuminate\Foundation\Testing\RefreshDatabase; use Tests\SetUp\Models\Product; use Tests\SetUp\Models\User; + use function Pest\Laravel\assertDatabaseCount; /* diff --git a/tests/Feature/Manager/Database/CartStoreTest.php b/tests/Feature/Manager/Database/CartStoreTest.php index a14561a..9a230b6 100644 --- a/tests/Feature/Manager/Database/CartStoreTest.php +++ b/tests/Feature/Manager/Database/CartStoreTest.php @@ -4,6 +4,7 @@ use Illuminate\Foundation\Testing\RefreshDatabase; use Tests\SetUp\Models\Product; use Tests\SetUp\Models\User; + use function Pest\Laravel\assertDatabaseCount; use function Pest\Laravel\assertDatabaseHas; diff --git a/tests/Feature/Manager/Database/CartUpdateQuantityTest.php b/tests/Feature/Manager/Database/CartUpdateQuantityTest.php index 015f985..7855e8e 100644 --- a/tests/Feature/Manager/Database/CartUpdateQuantityTest.php +++ b/tests/Feature/Manager/Database/CartUpdateQuantityTest.php @@ -6,6 +6,7 @@ use Illuminate\Foundation\Testing\RefreshDatabase; use Tests\SetUp\Models\Product; use Tests\SetUp\Models\User; + use function Pest\Laravel\assertDatabaseHas; use function Pest\Laravel\assertDatabaseMissing; @@ -88,7 +89,7 @@ assertDatabaseHas('cart_items', ['quantity' => 1]); // Increase quantity - LaravelCart::driver('database')->increaseQuantity($product2 , 2); + LaravelCart::driver('database')->increaseQuantity($product2, 2); assertDatabaseHas('cart_items', ['quantity' => 1]); assertDatabaseMissing('cart_items', ['quantity' => 3]); @@ -116,7 +117,7 @@ assertDatabaseHas('cart_items', ['quantity' => 3]); // Decrease quantity - LaravelCart::driver('database')->decreaseQuantity($product2 , 2); + LaravelCart::driver('database')->decreaseQuantity($product2, 2); assertDatabaseHas('cart_items', ['quantity' => 3]); assertDatabaseMissing('cart_items', ['quantity' => 1]); diff --git a/tests/Feature/Models/CartDeleteTest.php b/tests/Feature/Models/CartDeleteTest.php index 2adf2c3..d63be1e 100644 --- a/tests/Feature/Models/CartDeleteTest.php +++ b/tests/Feature/Models/CartDeleteTest.php @@ -4,6 +4,7 @@ use Illuminate\Foundation\Testing\RefreshDatabase; use Tests\SetUp\Models\Product; use Tests\SetUp\Models\User; + use function Pest\Laravel\assertDatabaseCount; /* diff --git a/tests/Feature/Models/CartStoreTest.php b/tests/Feature/Models/CartStoreTest.php index be90686..a363ef9 100644 --- a/tests/Feature/Models/CartStoreTest.php +++ b/tests/Feature/Models/CartStoreTest.php @@ -6,6 +6,7 @@ use Illuminate\Support\Facades\Artisan; use Tests\SetUp\Models\Product; use Tests\SetUp\Models\User; + use function Pest\Laravel\assertDatabaseCount; use function Pest\Laravel\assertDatabaseHas; use function Pest\Laravel\assertDatabaseMissing; diff --git a/tests/Feature/Models/CartUpdateQuantityTest.php b/tests/Feature/Models/CartUpdateQuantityTest.php index e9556f4..a4a8b14 100644 --- a/tests/Feature/Models/CartUpdateQuantityTest.php +++ b/tests/Feature/Models/CartUpdateQuantityTest.php @@ -5,6 +5,7 @@ use Illuminate\Foundation\Testing\RefreshDatabase; use Tests\SetUp\Models\Product; use Tests\SetUp\Models\User; + use function Pest\Laravel\assertDatabaseHas; /*