42 lines
865 B
PHP
42 lines
865 B
PHP
<?php
|
|
|
|
namespace App\Repositories;
|
|
|
|
use App\Models\InvoiceLine;
|
|
|
|
class InvoiceLineRepository implements InvoiceLineRepositoryInterface
|
|
{
|
|
public function create(array $data): InvoiceLine
|
|
{
|
|
return InvoiceLine::create($data);
|
|
}
|
|
|
|
public function update(string $id, array $data): bool
|
|
{
|
|
$line = $this->find($id);
|
|
if ($line) {
|
|
return $line->update($data);
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public function delete(string $id): bool
|
|
{
|
|
$line = $this->find($id);
|
|
if ($line) {
|
|
return $line->delete();
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public function find(string $id): ?InvoiceLine
|
|
{
|
|
return InvoiceLine::find($id);
|
|
}
|
|
|
|
public function getByInvoiceId(string $invoiceId)
|
|
{
|
|
return InvoiceLine::where('invoice_id', $invoiceId)->get();
|
|
}
|
|
}
|