/
itp_practice
/
itp_backend
Обзор
Документация
Войти
/
itp_practice
/
itp_backend
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
master
app/Models/CouponUsage.php
50 строк
1 KB
vivanenko
fix taps and others structure
27 май 2025, 18:06
27 май 2025, 18:06
8cdc7d9
Код
Авторство
О чём код?
<?php namespace App\Models; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Factories\HasFactory; /** * @property int $id * @property int $coupon_id * @property int $user_id * @property int|null $order_id * @property float $discount_amount * @property \DateTime $created_at * @property \DateTime $updated_at */ class CouponUsage extends Model { use HasFactory; protected $fillable = [ 'coupon_id', 'user_id', 'order_id', 'discount_amount', ]; protected $casts = [ 'coupon_id' => 'integer', 'user_id' => 'integer', 'order_id' => 'integer', 'discount_amount' => 'decimal:2', ]; public function coupon(): BelongsTo { return $this->belongsTo(Coupon::class); } public function user(): BelongsTo { return $this->belongsTo(User::class); } public function order(): BelongsTo { return $this->belongsTo(Order::class); } }