feat: Implement client status validation on login, refine password rules, and simplify customer resource status.
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories\InvoiceAttachment;
|
||||
|
||||
use App\Models\InvoiceAttachment;
|
||||
use App\Repositories\BaseRepository;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class InvoiceAttachmentRepository extends BaseRepository implements InvoiceAttachmentRepositoryInterface
|
||||
{
|
||||
public function getModel()
|
||||
{
|
||||
return InvoiceAttachment::class;
|
||||
}
|
||||
|
||||
public function getByInvoice(int $invoiceId): Collection
|
||||
{
|
||||
return $this->model->where('invoice_id', $invoiceId)->latest()->get();
|
||||
}
|
||||
|
||||
public function deleteWithFile(int $id): bool
|
||||
{
|
||||
$attachment = $this->find($id);
|
||||
if (!$attachment) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Storage::disk($attachment->disk)->delete($attachment->path);
|
||||
$attachment->delete();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user