1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-13 22:54:25 +01:00
invoiceninja/app/Services/ActivityService.php

50 lines
1.1 KiB
PHP
Raw Normal View History

2017-01-30 20:40:43 +01:00
<?php
namespace App\Services;
2015-11-05 23:37:04 +01:00
use App\Models\Client;
2016-05-23 18:52:20 +02:00
use App\Ninja\Datatables\ActivityDatatable;
2017-01-30 20:40:43 +01:00
use App\Ninja\Repositories\ActivityRepository;
2015-11-05 23:37:04 +01:00
/**
2017-01-30 20:40:43 +01:00
* Class ActivityService.
*/
2015-11-05 23:37:04 +01:00
class ActivityService extends BaseService
{
/**
* @var ActivityRepository
*/
2015-11-05 23:37:04 +01:00
protected $activityRepo;
/**
* @var DatatableService
*/
2015-11-05 23:37:04 +01:00
protected $datatableService;
/**
* ActivityService constructor.
*
* @param ActivityRepository $activityRepo
2017-01-30 20:40:43 +01:00
* @param DatatableService $datatableService
*/
2015-11-05 23:37:04 +01:00
public function __construct(ActivityRepository $activityRepo, DatatableService $datatableService)
{
$this->activityRepo = $activityRepo;
$this->datatableService = $datatableService;
}
/**
* @param null $clientPublicId
2017-01-30 20:40:43 +01:00
*
* @return \Illuminate\Http\JsonResponse
*/
2015-11-05 23:37:04 +01:00
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
}