Files
tehnobox/app/Models/OrderItem.php
ssww23 93a655235a
Some checks failed
Deploy / deploy (push) Has been cancelled
Initial commit
2026-03-10 00:55:37 +03:00

40 lines
702 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class OrderItem extends Model
{
use HasFactory;
protected $fillable = [
'order_id',
'product_id',
'name',
'price',
'quantity',
'subtotal',
];
protected function casts(): array
{
return [
'price' => 'decimal:2',
'subtotal' => 'decimal:2',
'quantity' => 'integer',
];
}
public function order()
{
return $this->belongsTo(Order::class);
}
public function product()
{
return $this->belongsTo(Product::class);
}
}