34 lines
617 B
PHP
34 lines
617 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\User;
|
|
use RuLong\Order\Models\Order;
|
|
|
|
class LotteryLog extends Model
|
|
{
|
|
protected $dates = [
|
|
'used_at',
|
|
];
|
|
|
|
public function user()
|
|
{
|
|
return $this->belongsTo(User::class)->withDefault();
|
|
}
|
|
|
|
public function lottery()
|
|
{
|
|
return $this->belongsTo(Lottery::class)->withDefault();
|
|
}
|
|
|
|
public function gift()
|
|
{
|
|
return $this->belongsTo(LotteryGift::class)->withDefault();
|
|
}
|
|
|
|
public function getOrderAttribute()
|
|
{
|
|
return Order::where('item_id', $this->id)->where('type', 'lottery')->first();
|
|
}
|
|
}
|