12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- <?php
- namespace App\Models;
- use Illuminate\Database\Eloquent\Model;
- use Illuminate\Database\Eloquent\Relations\BelongsTo;
- class FinanceRecord extends Model
- {
- protected $fillable = [
- 'record_no',
- 'owner_type',
- 'agent_id',
- 'order_id',
- 'withdraw_id',
- 'recharge_id',
- 'type',
- 'business_type',
- 'amount',
- 'payment_type',
- 'region_code',
- 'user_id',
- 'coach_id',
- 'remark'
- ];
- protected $casts = [
- 'amount' => 'decimal:2',
- 'created_at' => 'datetime',
- 'updated_at' => 'datetime'
- ];
- /**
- * 关联订单
- */
- public function order(): BelongsTo
- {
- return $this->belongsTo(Order::class);
- }
- /**
- * 关联用户
- */
- public function user(): BelongsTo
- {
- return $this->belongsTo(MemberUser::class, 'user_id');
- }
- /**
- * 关联技师
- */
- public function coach(): BelongsTo
- {
- return $this->belongsTo(CoachUser::class, 'coach_id');
- }
- /**
- * 关联代理商
- */
- public function agent(): BelongsTo
- {
- return $this->belongsTo(AgentInfo::class, 'agent_id');
- }
- }
|