42 lines
841 B
PHP
42 lines
841 B
PHP
<?php
|
|
|
|
namespace App\Repositories;
|
|
|
|
use App\Models\QuoteLine;
|
|
|
|
class QuoteLineRepository implements QuoteLineRepositoryInterface
|
|
{
|
|
public function create(array $data): QuoteLine
|
|
{
|
|
return QuoteLine::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): ?QuoteLine
|
|
{
|
|
return QuoteLine::find($id);
|
|
}
|
|
|
|
public function getByQuoteId(string $quoteId)
|
|
{
|
|
return QuoteLine::where('quote_id', $quoteId)->get();
|
|
}
|
|
}
|