| 12345678910111213141516171819202122232425262728293031 |
- <?php
-
- namespace App\Models;
-
- use Illuminate\Database\Eloquent\Attributes\Fillable;
- use Illuminate\Database\Eloquent\Model;
- use Illuminate\Database\Eloquent\Relations\BelongsTo;
-
- /**
- * One line of an order: a product, its price at the time, and how many.
- *
- * @property int $id
- * @property int $store_id
- * @property int $order_id
- * @property int|null $product_id
- * @property string $name
- * @property int $unit_price
- * @property int $quantity
- * @property int $line_total
- */
- #[Fillable(['store_id', 'product_id', 'name', 'unit_price', 'quantity', 'line_total'])]
- class OrderItem extends Model
- {
- /**
- * @return BelongsTo<Order, $this>
- */
- public function order(): BelongsTo
- {
- return $this->belongsTo(Order::class);
- }
- }
|