24 lines
478 B
PHP
24 lines
478 B
PHP
<?php
|
|
|
|
namespace App\Services\Reimbursements;
|
|
|
|
use App\Models\Reimbursement;
|
|
|
|
class ReimbursementLookupService
|
|
{
|
|
public function findReimbursementIdForExpense(int $expenseId): ?int
|
|
{
|
|
if ($expenseId <= 0) {
|
|
return null;
|
|
}
|
|
|
|
$row = Reimbursement::query()
|
|
->select('id')
|
|
->where('expense_id', $expenseId)
|
|
->orderByDesc('id')
|
|
->first();
|
|
|
|
return $row ? (int) $row->id : null;
|
|
}
|
|
}
|