diff --git a/app/Models/ProductSku.php b/app/Models/ProductSku.php index 596f0fe1..eaefe3ae 100644 --- a/app/Models/ProductSku.php +++ b/app/Models/ProductSku.php @@ -5,10 +5,12 @@ namespace App\Models; use App\Casts\JsonArray; use App\Casts\Price; use Dcat\Admin\Traits\HasDateTimeFormatter; +use EloquentFilter\Filterable; use Illuminate\Database\Eloquent\Model; class ProductSku extends Model { + use Filterable; use HasDateTimeFormatter; protected $casts = [ @@ -19,5 +21,6 @@ class ProductSku extends Model 'user_price' => Price::class, 'attrs' => JsonArray::class, 'is_sell' => 'bool', + 'is_recommend' => 'bool', ]; } diff --git a/app/Models/ProductSpu.php b/app/Models/ProductSpu.php index b69bbbf7..ea756ad1 100644 --- a/app/Models/ProductSpu.php +++ b/app/Models/ProductSpu.php @@ -10,7 +10,6 @@ use Illuminate\Database\Eloquent\Model; class ProductSpu extends Model { use HasDateTimeFormatter; - protected $table = 'product_spus'; protected $casts = [ 'images' => JsonArray::class, @@ -20,5 +19,6 @@ class ProductSpu extends Model 'user_price' => Price::class, 'attrs' => JsonArray::class, 'is_sell' => 'bool', + 'is_recommend' => 'bool', ]; } diff --git a/database/migrations/2021_11_22_110044_create_product_spus_table.php b/database/migrations/2021_11_22_110044_create_product_spus_table.php index aff6f2f8..e7d3e620 100644 --- a/database/migrations/2021_11_22_110044_create_product_spus_table.php +++ b/database/migrations/2021_11_22_110044_create_product_spus_table.php @@ -29,6 +29,7 @@ class CreateProductSpusTable extends Migration $table->integer('weight')->unsigned()->nullable()->comment('重量:g'); $table->json('attrs')->nullable()->comment('属性文本'); $table->tinyInteger('is_sell')->unsigned()->default(0)->comment('在售状态'); + $table->tinyInteger('is_recommend')->unsigned()->default(0)->comment('是否推荐'); $table->timestamps(); }); } diff --git a/database/migrations/2021_11_24_120232_create_product_skus_table.php b/database/migrations/2021_11_24_120232_create_product_skus_table.php index 4a65ad8f..5da63adb 100644 --- a/database/migrations/2021_11_24_120232_create_product_skus_table.php +++ b/database/migrations/2021_11_24_120232_create_product_skus_table.php @@ -30,6 +30,7 @@ class CreateProductSkusTable extends Migration $table->integer('weight')->unsigned()->nullable()->comment('重量:g'); $table->json('attrs')->nullable()->comment('属性文本'); $table->tinyInteger('is_sell')->unsigned()->default(0)->comment('在售状态'); + $table->tinyInteger('is_recommend')->unsigned()->default(0)->comment('是否推荐'); $table->json('spec_items')->nullable()->comment('规格属性'); $table->integer('stock')->unsigned()->default(0)->comment('库存'); $table->integer('sells')->unsigned()->default(0)->comment('销量');