mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-08 12:12:48 +01:00
0fbda85a59
- Removed unused uses - Type hinting for method parameters - Removed commented code - Introduced comments for classes and methods - Short array syntax
32 lines
972 B
PHP
32 lines
972 B
PHP
<?php namespace App\Services;
|
|
|
|
use Auth;
|
|
use Utils;
|
|
use App\Ninja\Repositories\InvoiceRepository;
|
|
use App\Ninja\Datatables\RecurringInvoiceDatatable;
|
|
|
|
class RecurringInvoiceService extends BaseService
|
|
{
|
|
protected $invoiceRepo;
|
|
protected $datatableService;
|
|
|
|
public function __construct(InvoiceRepository $invoiceRepo, DatatableService $datatableService)
|
|
{
|
|
$this->invoiceRepo = $invoiceRepo;
|
|
$this->datatableService = $datatableService;
|
|
}
|
|
|
|
public function getDatatable($accountId, $clientPublicId = null, $entityType, $search)
|
|
{
|
|
$datatable = new RecurringInvoiceDatatable( ! $clientPublicId, $clientPublicId);
|
|
$query = $this->invoiceRepo->getRecurringInvoices($accountId, $clientPublicId, $search);
|
|
|
|
if(!Utils::hasPermission('view_all')){
|
|
$query->where('invoices.user_id', '=', Auth::user()->id);
|
|
}
|
|
|
|
return $this->datatableService->createDatatable($datatable, $query);
|
|
}
|
|
|
|
}
|