49 lines
928 B
PHP
49 lines
928 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Dcat\Admin\Traits\HasDateTimeFormatter;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Order extends Model
|
|
{
|
|
use HasDateTimeFormatter;
|
|
|
|
protected $fillable = [
|
|
'user_id',
|
|
'order_phone',
|
|
'order_sn',
|
|
'order_number',
|
|
'order_price',
|
|
'pay_price',
|
|
'pay_type',
|
|
'order_status',
|
|
'pay_status',
|
|
'shipping_status',
|
|
'pay_time',
|
|
'shipping_time',
|
|
'closed_time',
|
|
'is_niu',
|
|
'number_time',
|
|
'is_reserve',
|
|
'reserve_time',
|
|
'pickup_notice'
|
|
];
|
|
|
|
public function user(){
|
|
return $this->belongsTo(User::class, 'user_id');
|
|
}
|
|
|
|
public function goods(){
|
|
return $this->hasMany(OrderGoods::class, 'order_id');
|
|
}
|
|
|
|
public function payLog(){
|
|
return $this->hasOne(PayLog::class, 'order_sn', 'order_sn')->where('status', '>=', 0);
|
|
}
|
|
|
|
public function ticket(){
|
|
return $this->hasOne(UserTicket::class, 'id', 'ticket_id');
|
|
}
|
|
}
|