1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-13 22:54:25 +01:00
invoiceninja/app/Services/BaseService.php
Hillel Coren 03035e8bdf Bug fixes
2015-11-15 12:08:32 +02:00

48 lines
1.1 KiB
PHP

<?php namespace App\Services;
use Illuminate\Foundation\Bus\DispatchesCommands;
use App\Services\DatatableService;
class BaseService
{
use DispatchesCommands;
protected function getRepo()
{
return null;
}
public function bulk($ids, $action)
{
if ( ! $ids) {
return 0;
}
$entities = $this->getRepo()->findByPublicIdsWithTrashed($ids);
foreach ($entities as $entity) {
$this->getRepo()->$action($entity);
}
return count($entities);
}
public function createDatatable($entityType, $query, $showCheckbox = true, $hideClient = false)
{
$columns = $this->getDatatableColumns($entityType, !$showCheckbox);
$actions = $this->getDatatableActions($entityType);
return $this->datatableService->createDatatable($entityType, $query, $columns, $actions, $showCheckbox);
}
protected function getDatatableColumns($entityType, $hideClient)
{
return [];
}
protected function getDatatableActions($entityType)
{
return [];
}
}