48 lines
1.2 KiB
PHP
48 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Database\Factories\MedicationExpenseRowFactory;
|
|
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
#[Fillable(['report_period_id', 'department_id'])]
|
|
class MedicationExpenseRow extends Model
|
|
{
|
|
/** @use HasFactory<MedicationExpenseRowFactory> */
|
|
use HasFactory;
|
|
|
|
/**
|
|
* Get the period that owns the row.
|
|
*
|
|
* @return BelongsTo<ReportPeriod, $this>
|
|
*/
|
|
public function reportPeriod(): BelongsTo
|
|
{
|
|
return $this->belongsTo(ReportPeriod::class);
|
|
}
|
|
|
|
/**
|
|
* Get the department that owns the row.
|
|
*
|
|
* @return BelongsTo<Department, $this>
|
|
*/
|
|
public function department(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Department::class);
|
|
}
|
|
|
|
/**
|
|
* Get the values for the row.
|
|
*
|
|
* @return HasMany<MedicationExpenseValue, $this>
|
|
*/
|
|
public function values(): HasMany
|
|
{
|
|
return $this->hasMany(MedicationExpenseValue::class);
|
|
}
|
|
}
|