27 lines
528 B
PHP
27 lines
528 B
PHP
<?php
|
|||
|
|
|
||
|
|
namespace App\Models;
|
||
|
|
|
||
|
|
use Illuminate\Database\Eloquent\Model;
|
||
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||
|
|
|
||
|
|
class OrderItem extends Model
|
||
|
|
{
|
||
|
|
protected $fillable = ['order_id', 'plan_id', 'title', 'amount_cents'];
|
||
|
|
|
||
|
|
protected function casts(): array
|
||
|
|
{
|
||
|
|
return ['amount_cents' => 'integer'];
|
||
|
|
}
|
||
|
|
|
||
|
|
public function order(): BelongsTo
|
||
|
|
{
|
||
|
|
return $this->belongsTo(Order::class);
|
||
|
|
}
|
||
|
|
|
||
|
|
public function plan(): BelongsTo
|
||
|
|
{
|
||
|
|
return $this->belongsTo(Plan::class);
|
||
|
|
}
|
||
|
|
}
|