29 lines
588 B
PHP
29 lines
588 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Carbon\Carbon;
|
|
|
|
class LuckyWheelPrize extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = ['name','voucher_event_id'];
|
|
|
|
public function voucher(){
|
|
return $this->belongsTo(Voucher::class);
|
|
}
|
|
|
|
public function voucherEvent(){
|
|
return $this->belongsTo(VoucherEvent::class);
|
|
}
|
|
|
|
public function gets(){
|
|
return $this->hasMany(LuckyWheelGet::class,"prize_id")
|
|
->whereDate("created_at", Carbon::now());
|
|
}
|
|
|
|
}
|