/
hikqri
/
up
Обзор
Документация
Войти
/
hikqri
/
up
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
app/Models/Order.php
44 строки
873 B
Myckaa
first_commit
26 июн 2026, 18:36
26 июн 2026, 18:36
8095503
Код
Авторство
О чём код?
<?php namespace App\Models; use Illuminate\Database\Eloquent\Model; class Order extends Model { protected $fillable = [ 'user_id', 'status', 'total', 'customer_name', 'customer_email', 'customer_phone', 'address', 'comment', ]; protected $casts = [ 'total' => 'decimal:2', ]; public function user() { return $this->belongsTo(User::class); } public function items() { return $this->hasMany(OrderItem::class); } public function statusLabel(): string { return match ($this->status) { 'pending' => 'Новый', 'processing' => 'В обработке', 'completed' => 'Выполнен', 'cancelled' => 'Отменён', default => $this->status, }; } }