invoiceninja/app/Services/BaseService.php
2015-10-28 21:22:07 +02:00

29 lines
537 B
PHP

<?php namespace App\Services;
use Illuminate\Foundation\Bus\DispatchesCommands;
class BaseService
{
use DispatchesCommands;
protected function getRepo()
{
return null;
}
public function bulk($ids, $action, $param = null)
{
if ( ! $ids) {
return 0;
}
$entities = $this->getRepo()->findByPublicIdsWithTrashed($ids);
foreach ($entities as $entity) {
$this->getRepo()->$action($entity, $param);
}
return count($entities);
}
}