2015-11-05 23:37:04 +01:00
|
|
|
<?php namespace App\Services;
|
|
|
|
|
|
|
|
use Utils;
|
|
|
|
use App\Models\Client;
|
|
|
|
use App\Services\BaseService;
|
|
|
|
use App\Ninja\Repositories\ActivityRepository;
|
2016-05-23 18:52:20 +02:00
|
|
|
use App\Ninja\Datatables\ActivityDatatable;
|
2015-11-05 23:37:04 +01:00
|
|
|
|
|
|
|
class ActivityService extends BaseService
|
|
|
|
{
|
|
|
|
protected $activityRepo;
|
|
|
|
protected $datatableService;
|
|
|
|
|
|
|
|
public function __construct(ActivityRepository $activityRepo, DatatableService $datatableService)
|
|
|
|
{
|
|
|
|
$this->activityRepo = $activityRepo;
|
|
|
|
$this->datatableService = $datatableService;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getDatatable($clientPublicId = null)
|
|
|
|
{
|
2015-11-16 13:30:44 +01:00
|
|
|
$clientId = Client::getPrivateId($clientPublicId);
|
|
|
|
|
|
|
|
$query = $this->activityRepo->findByClientId($clientId);
|
2015-11-05 23:37:04 +01:00
|
|
|
|
2016-05-23 18:52:20 +02:00
|
|
|
return $this->datatableService->createDatatable(new ActivityDatatable(false), $query);
|
2015-11-05 23:37:04 +01:00
|
|
|
}
|
|
|
|
|
2016-05-23 18:52:20 +02:00
|
|
|
}
|