first commit
This commit is contained in:
15
app/common/model/AdminToken.php
Normal file
15
app/common/model/AdminToken.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
namespace app\common\model;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class AdminToken extends Model
|
||||
{
|
||||
protected $table = 'admin_tokens';
|
||||
protected $guarded = [];
|
||||
protected $hidden = ['token_hash', 'updated_at'];
|
||||
protected $casts = [
|
||||
'expired_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
17
app/common/model/AdminUser.php
Normal file
17
app/common/model/AdminUser.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
namespace app\common\model;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class AdminUser extends Model
|
||||
{
|
||||
protected $table = 'admin_users';
|
||||
protected $guarded = [];
|
||||
protected $hidden = ['password_hash', 'updated_at'];
|
||||
|
||||
public function roles()
|
||||
{
|
||||
return $this->belongsToMany(Role::class, 'admin_roles', 'admin_id', 'role_id');
|
||||
}
|
||||
}
|
||||
|
||||
20
app/common/model/Order.php
Normal file
20
app/common/model/Order.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
namespace app\common\model;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Order extends Model
|
||||
{
|
||||
protected $table = 'orders';
|
||||
|
||||
protected $guarded = [];
|
||||
|
||||
// 隐藏时间戳等不必要字段,保持前端接口整洁
|
||||
protected $hidden = ['updated_at'];
|
||||
|
||||
// 关联订单流转日志 (时间轴)
|
||||
public function logs()
|
||||
{
|
||||
return $this->hasMany(OrderLog::class, 'order_id', 'id')->orderBy('created_at', 'desc');
|
||||
}
|
||||
}
|
||||
11
app/common/model/OrderLog.php
Normal file
11
app/common/model/OrderLog.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
namespace app\common\model;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class OrderLog extends Model
|
||||
{
|
||||
protected $table = 'order_logs';
|
||||
|
||||
protected $guarded = [];
|
||||
}
|
||||
15
app/common/model/PaymentTransaction.php
Normal file
15
app/common/model/PaymentTransaction.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
namespace app\common\model;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class PaymentTransaction extends Model
|
||||
{
|
||||
protected $table = 'payment_transactions';
|
||||
protected $guarded = [];
|
||||
protected $hidden = ['updated_at'];
|
||||
|
||||
protected $casts = [
|
||||
'raw_json' => 'array',
|
||||
];
|
||||
}
|
||||
12
app/common/model/Permission.php
Normal file
12
app/common/model/Permission.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
namespace app\common\model;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Permission extends Model
|
||||
{
|
||||
protected $table = 'permissions';
|
||||
protected $guarded = [];
|
||||
protected $hidden = ['updated_at'];
|
||||
}
|
||||
|
||||
26
app/common/model/Report.php
Normal file
26
app/common/model/Report.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
namespace app\common\model;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Report extends Model
|
||||
{
|
||||
protected $table = 'reports';
|
||||
protected $guarded = [];
|
||||
|
||||
// Cast JSON fields automatically
|
||||
protected $casts = [
|
||||
'flaws_json' => 'array',
|
||||
'images_json' => 'array',
|
||||
];
|
||||
|
||||
public function order()
|
||||
{
|
||||
return $this->belongsTo(Order::class, 'order_id');
|
||||
}
|
||||
|
||||
public function inspector()
|
||||
{
|
||||
return $this->belongsTo(AdminUser::class, 'inspector_id');
|
||||
}
|
||||
}
|
||||
17
app/common/model/Role.php
Normal file
17
app/common/model/Role.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
namespace app\common\model;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Role extends Model
|
||||
{
|
||||
protected $table = 'roles';
|
||||
protected $guarded = [];
|
||||
protected $hidden = ['updated_at'];
|
||||
|
||||
public function permissions()
|
||||
{
|
||||
return $this->belongsToMany(Permission::class, 'role_permissions', 'role_id', 'permission_id');
|
||||
}
|
||||
}
|
||||
|
||||
12
app/common/model/User.php
Normal file
12
app/common/model/User.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
namespace app\common\model;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class User extends Model
|
||||
{
|
||||
protected $table = 'users';
|
||||
protected $guarded = [];
|
||||
protected $hidden = ['updated_at'];
|
||||
}
|
||||
|
||||
15
app/common/model/UserToken.php
Normal file
15
app/common/model/UserToken.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
namespace app\common\model;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class UserToken extends Model
|
||||
{
|
||||
protected $table = 'user_tokens';
|
||||
protected $guarded = [];
|
||||
protected $hidden = ['token_hash', 'updated_at'];
|
||||
protected $casts = [
|
||||
'expired_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
12
app/common/model/UserWechatIdentity.php
Normal file
12
app/common/model/UserWechatIdentity.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
namespace app\common\model;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class UserWechatIdentity extends Model
|
||||
{
|
||||
protected $table = 'user_wechat_identities';
|
||||
protected $guarded = [];
|
||||
protected $hidden = ['updated_at'];
|
||||
}
|
||||
|
||||
12
app/common/model/WechatApp.php
Normal file
12
app/common/model/WechatApp.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
namespace app\common\model;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class WechatApp extends Model
|
||||
{
|
||||
protected $table = 'wechat_apps';
|
||||
protected $guarded = [];
|
||||
protected $hidden = ['updated_at', 'app_secret'];
|
||||
}
|
||||
|
||||
11
app/common/model/WechatMerchant.php
Normal file
11
app/common/model/WechatMerchant.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
namespace app\common\model;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class WechatMerchant extends Model
|
||||
{
|
||||
protected $table = 'wechat_merchants';
|
||||
protected $guarded = [];
|
||||
protected $hidden = ['updated_at', 'api_v3_key', 'private_key_pem', 'apiclient_cert_path', 'apiclient_key_path'];
|
||||
}
|
||||
Reference in New Issue
Block a user