36 lines
724 B
PHP
36 lines
724 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
class Invoice extends Model
|
|
{
|
|
protected $fillable = [
|
|
'student_id',
|
|
'period_start',
|
|
'period_end',
|
|
'total',
|
|
'status',
|
|
'pdf_path',
|
|
];
|
|
|
|
/**
|
|
* The student this invoice is for.
|
|
*/
|
|
public function student(): BelongsTo
|
|
{
|
|
return $this->belongsTo(StudentProfile::class, 'student_id');
|
|
}
|
|
|
|
/**
|
|
* All invoice line items associated with this invoice.
|
|
*/
|
|
public function items(): HasMany
|
|
{
|
|
return $this->hasMany(InvoiceItem::class);
|
|
}
|
|
}
|