商品、订单部分相关代码生成,下一步先把商品搞完再搞订单
Some checks failed
Tests / PHP 8.2 (push) Has been cancelled
Tests / PHP 8.3 (push) Has been cancelled
Tests / PHP 8.4 (push) Has been cancelled

This commit is contained in:
2025-05-20 16:52:47 +08:00
parent 5bd5938e5c
commit 035ab1105c
45 changed files with 1951 additions and 151 deletions

View File

@@ -4,10 +4,10 @@ namespace App\Models;
use App\BaseApp\BaseModel;
class StoreClassificationModel extends BaseModel
class MallClassificationModel extends BaseModel
{
protected $table = 'store_classification';
protected $table = 'mall_classification';
/**
* The attributes that are mass assignable.
*

View File

@@ -0,0 +1,26 @@
<?php
namespace App\Models;
use App\BaseApp\BaseModel;
class MallMembershipLevelModel extends BaseModel
{
protected $table = 'mall_membership_level';
/**
* The attributes that are mass assignable.
*
* @var list<string>
*/
protected $guarded = [];
public function product()
{
return $this->hasOne(ProductModel::class, 'id', 'product_id');
}
public function user()
{
return $this->hasOne(UserModel::class, 'id', 'user_id');
}
}

View File

@@ -4,10 +4,10 @@ namespace App\Models;
use App\BaseApp\BaseModel;
class StoreModel extends BaseModel
class MallModel extends BaseModel
{
protected $table = 'store';
protected $table = 'mall';
/**
* The attributes that are mass assignable.
*

View File

@@ -0,0 +1,17 @@
<?php
namespace App\Models;
use App\BaseApp\BaseModel;
class OrderDetailModel extends BaseModel
{
protected $table = 'order_detail';
/**
* The attributes that are mass assignable.
*
* @var list<string>
*/
protected $guarded = [];
}

17
app/Models/OrderModel.php Normal file
View File

@@ -0,0 +1,17 @@
<?php
namespace App\Models;
use App\BaseApp\BaseModel;
class OrderModel extends BaseModel
{
protected $table = 'order';
/**
* The attributes that are mass assignable.
*
* @var list<string>
*/
protected $guarded = [];
}

View File

@@ -0,0 +1,17 @@
<?php
namespace App\Models;
use App\BaseApp\BaseModel;
class ProductLabelRelationsModel extends BaseModel
{
protected $table = 'product_label_relations';
/**
* The attributes that are mass assignable.
*
* @var list<string>
*/
protected $guarded = [];
}

View File

@@ -20,4 +20,30 @@ class ProductModel extends BaseModel
{
return $this->hasMany(ProductImageModel::class, 'product_id', 'id');
}
public function mall()
{
return $this->hasOne(MallModel::class, 'id', 'mall_id');
}
public function user()
{
return $this->hasOne(AdminModel::class, 'id', 'user_id');
}
public function labels()
{
// return $this->hasMany(ProductLabelRelationsModel::class, 'product_id', 'id');
return $this->belongsToMany(ProductLabelModel::class, 'product_label_relations', 'product_id', 'label_id');
}
public function classification()
{
return $this->hasOne(ProductClassificationModel::class, 'id', 'classification_id');
}
public function skus()
{
return $this->hasMany(SkuModel::class, 'product_id', 'id');
}
}

22
app/Models/SkuModel.php Normal file
View File

@@ -0,0 +1,22 @@
<?php
namespace App\Models;
use App\BaseApp\BaseModel;
class SkuModel extends BaseModel
{
protected $table = 'sku';
/**
* The attributes that are mass assignable.
*
* @var list<string>
*/
protected $guarded = [];
public function product()
{
return $this->hasOne(ProductModel::class, 'id', 'product_id');
}
}

View File

@@ -0,0 +1,27 @@
<?php
namespace App\Models;
use App\BaseApp\BaseModel;
class UserBrowsingHistoryModel extends BaseModel
{
protected $table = 'user_browsing_history';
/**
* The attributes that are mass assignable.
*
* @var list<string>
*/
protected $guarded = [];
public function product()
{
return $this->hasOne(ProductModel::class, 'id', 'product_id');
}
public function user()
{
return $this->hasOne(UserModel::class, 'id', 'user_id');
}
}

View File

@@ -0,0 +1,26 @@
<?php
namespace App\Models;
use App\BaseApp\BaseModel;
class UserCollectModel extends BaseModel
{
protected $table = 'user_collect';
/**
* The attributes that are mass assignable.
*
* @var list<string>
*/
protected $guarded = [];
public function product()
{
return $this->hasOne(ProductModel::class, 'id', 'product_id');
}
public function user()
{
return $this->hasOne(UserModel::class, 'id', 'user_id');
}
}

View File

@@ -0,0 +1,17 @@
<?php
namespace App\Models;
use App\BaseApp\BaseModel;
class UserMembershipModel extends BaseModel
{
protected $table = 'user_membership';
/**
* The attributes that are mass assignable.
*
* @var list<string>
*/
protected $guarded = [];
}

17
app/Models/UserModel.php Normal file
View File

@@ -0,0 +1,17 @@
<?php
namespace App\Models;
use App\BaseApp\BaseModel;
class UserModel extends BaseModel
{
protected $table = 'user';
/**
* The attributes that are mass assignable.
*
* @var list<string>
*/
protected $guarded = [];
}

View File

@@ -0,0 +1,22 @@
<?php
namespace App\Models;
use App\BaseApp\BaseModel;
class UserReceivingAddressModel extends BaseModel
{
protected $table = 'user_receiving_address';
/**
* The attributes that are mass assignable.
*
* @var list<string>
*/
protected $guarded = [];
public function user()
{
return $this->hasOne(UserModel::class, 'id', 'user_id');
}
}