35 lines
696 B
PHP
35 lines
696 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class InvoiceItem extends Model
|
|
{
|
|
protected $fillable = [
|
|
'invoice_id',
|
|
'attendance_id',
|
|
'description',
|
|
'quantity',
|
|
'unit_price',
|
|
'amount',
|
|
];
|
|
|
|
/**
|
|
* The invoice this line item belongs to.
|
|
*/
|
|
public function invoice(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Invoice::class);
|
|
}
|
|
|
|
/**
|
|
* The attendance record this line item is based on.
|
|
*/
|
|
public function attendance(): BelongsTo
|
|
{
|
|
return $this->belongsTo(LessonAttendance::class, 'attendance_id');
|
|
}
|
|
}
|