style updates
This commit is contained in:
@@ -1,11 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Commerce\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
final class Category extends Model
|
||||
{
|
||||
|
||||
protected $table = 'commerce_categories';
|
||||
|
||||
protected $guarded = [];
|
||||
protected function casts(): array { return ['is_active'=>'boolean']; }
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return ['is_active' => 'boolean'];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Commerce\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
final class Customer extends Model
|
||||
{
|
||||
|
||||
protected $table = 'commerce_customers';
|
||||
|
||||
protected $guarded = [];
|
||||
protected function casts(): array { return ['billing_address'=>'array','shipping_address'=>'array']; }
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return ['billing_address' => 'array', 'shipping_address' => 'array'];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Commerce\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
final class InventoryMovement extends Model
|
||||
{
|
||||
|
||||
protected $table = 'commerce_inventory_movements';
|
||||
|
||||
protected $guarded = [];
|
||||
protected function casts(): array { return []; }
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Commerce\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
final class Order extends Model
|
||||
{
|
||||
|
||||
protected $table = 'commerce_orders';
|
||||
|
||||
protected $guarded = [];
|
||||
protected function casts(): array { return ['subtotal'=>'decimal:2','discount_total'=>'decimal:2','shipping_total'=>'decimal:2','tax_total'=>'decimal:2','grand_total'=>'decimal:2','billing_address'=>'array','shipping_address'=>'array','placed_at'=>'datetime']; }
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return ['subtotal' => 'decimal:2', 'discount_total' => 'decimal:2', 'shipping_total' => 'decimal:2', 'tax_total' => 'decimal:2', 'grand_total' => 'decimal:2', 'billing_address' => 'array', 'shipping_address' => 'array', 'placed_at' => 'datetime'];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Commerce\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
final class OrderItem extends Model
|
||||
{
|
||||
|
||||
protected $table = 'commerce_order_items';
|
||||
|
||||
protected $guarded = [];
|
||||
protected function casts(): array { return ['unit_price'=>'decimal:2','tax_total'=>'decimal:2','line_total'=>'decimal:2','metadata'=>'array']; }
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return ['unit_price' => 'decimal:2', 'tax_total' => 'decimal:2', 'line_total' => 'decimal:2', 'metadata' => 'array'];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Commerce\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
final class Product extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'commerce_products';
|
||||
|
||||
protected $guarded = [];
|
||||
protected function casts(): array { return ['price'=>'decimal:2','compare_at_price'=>'decimal:2','cost_price'=>'decimal:2','track_inventory'=>'boolean','is_featured'=>'boolean','published_at'=>'datetime','metadata'=>'array']; }
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return ['price' => 'decimal:2', 'compare_at_price' => 'decimal:2', 'cost_price' => 'decimal:2', 'track_inventory' => 'boolean', 'is_featured' => 'boolean', 'published_at' => 'datetime', 'metadata' => 'array'];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Commerce\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
final class ProductVariant extends Model
|
||||
{
|
||||
|
||||
protected $table = 'commerce_product_variants';
|
||||
|
||||
protected $guarded = [];
|
||||
protected function casts(): array { return ['price'=>'decimal:2','options'=>'array','is_active'=>'boolean']; }
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return ['price' => 'decimal:2', 'options' => 'array', 'is_active' => 'boolean'];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Commerce\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
final class Promotion extends Model
|
||||
{
|
||||
|
||||
protected $table = 'commerce_promotions';
|
||||
|
||||
protected $guarded = [];
|
||||
protected function casts(): array { return ['value'=>'decimal:2','minimum_order'=>'decimal:2','starts_at'=>'datetime','ends_at'=>'datetime','is_active'=>'boolean','conditions'=>'array']; }
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return ['value' => 'decimal:2', 'minimum_order' => 'decimal:2', 'starts_at' => 'datetime', 'ends_at' => 'datetime', 'is_active' => 'boolean', 'conditions' => 'array'];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
<?php
|
||||
|
||||
// Relationship reference: Product belongsTo Category and hasMany ProductVariant; Order hasMany OrderItem and belongsTo Customer.
|
||||
|
||||
Reference in New Issue
Block a user