Skip to content

Commit

Permalink
remove uuid concept from cart
Browse files Browse the repository at this point in the history
  • Loading branch information
iamgergo committed May 20, 2021
1 parent b6e57bb commit 46aba43
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public function up(): void
{
Schema::create('bazar_addresses', static function (Blueprint $table): void {
$table->id();
$table->uuidMorphs('addressable');
$table->morphs('addressable');
$table->string('first_name', 60)->nullable();
$table->string('last_name', 60)->nullable();
$table->string('country', 2)->nullable();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public function up(): void
Schema::create('bazar_items', static function (Blueprint $table): void {
$table->uuid('id')->primary();
$table->foreignId('product_id')->nullable()->constrained('bazar_products')->nullOnDelete();
$table->uuidMorphs('itemable');
$table->morphs('itemable');
$table->unsignedDecimal('price');
$table->unsignedDecimal('tax')->default(0);
$table->unsignedDecimal('quantity');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class CreateBazarCartsTable extends Migration
public function up(): void
{
Schema::create('bazar_carts', static function (Blueprint $table): void {
$table->uuid('id')->primary();
$table->id('id');
$table->foreignId('user_id')->nullable()->constrained()->cascadeOnDelete();
$table->foreignId('order_id')->nullable()->constrained('bazar_orders')->cascadeOnDelete();
$table->string('currency');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public function up(): void
{
Schema::create('bazar_shippings', static function (Blueprint $table): void {
$table->id();
$table->uuidMorphs('shippable');
$table->morphs('shippable');
$table->string('driver');
$table->unsignedDecimal('cost')->default(0);
$table->unsignedDecimal('tax')->default(0);
Expand Down
17 changes: 0 additions & 17 deletions src/Models/Cart.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Bazar\Bazar;
use Bazar\Concerns\Addressable;
use Bazar\Concerns\HasUuid;
use Bazar\Concerns\InteractsWithDiscounts;
use Bazar\Concerns\InteractsWithItems;
use Bazar\Concerns\InteractsWithProxy;
Expand All @@ -20,7 +19,6 @@ class Cart extends Model implements Contract
{
use Addressable;
use HasFactory;
use HasUuid;
use InteractsWithDiscounts;
use InteractsWithItems;
use InteractsWithProxy;
Expand Down Expand Up @@ -52,26 +50,11 @@ class Cart extends Model implements Contract
* @var array
*/
protected $fillable = [
'id',
'locked',
'discount',
'currency',
];

/**
* The "type" of the primary key ID.
*
* @var string
*/
protected $keyType = 'string';

/**
* Indicates if the IDs are auto-incrementing.
*
* @var bool
*/
public $incrementing = false;

/**
* The table associated with the model.
*
Expand Down

0 comments on commit 46aba43

Please sign in to comment.