mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-03 21:07:30 -05:00 
			
		
		
		
	- Removed unused uses - Type hinting for method parameters - Removed commented code - Introduced comments for classes and methods - Short array syntax
		
			
				
	
	
		
			47 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			47 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php namespace App\Services;
 | 
						|
 | 
						|
use App\Models\Client;
 | 
						|
use App\Ninja\Repositories\ActivityRepository;
 | 
						|
use App\Ninja\Datatables\ActivityDatatable;
 | 
						|
 | 
						|
/**
 | 
						|
 * Class ActivityService
 | 
						|
 */
 | 
						|
class ActivityService extends BaseService
 | 
						|
{
 | 
						|
    /**
 | 
						|
     * @var ActivityRepository
 | 
						|
     */
 | 
						|
    protected $activityRepo;
 | 
						|
 | 
						|
    /**
 | 
						|
     * @var DatatableService
 | 
						|
     */
 | 
						|
    protected $datatableService;
 | 
						|
 | 
						|
    /**
 | 
						|
     * ActivityService constructor.
 | 
						|
     *
 | 
						|
     * @param ActivityRepository $activityRepo
 | 
						|
     * @param DatatableService $datatableService
 | 
						|
     */
 | 
						|
    public function __construct(ActivityRepository $activityRepo, DatatableService $datatableService)
 | 
						|
    {
 | 
						|
        $this->activityRepo = $activityRepo;
 | 
						|
        $this->datatableService = $datatableService;
 | 
						|
    }
 | 
						|
 | 
						|
    /**
 | 
						|
     * @param null $clientPublicId
 | 
						|
     * @return \Illuminate\Http\JsonResponse
 | 
						|
     */
 | 
						|
    public function getDatatable($clientPublicId = null)
 | 
						|
    {
 | 
						|
        $clientId = Client::getPrivateId($clientPublicId);
 | 
						|
 | 
						|
        $query = $this->activityRepo->findByClientId($clientId);
 | 
						|
 | 
						|
        return $this->datatableService->createDatatable(new ActivityDatatable(false), $query);
 | 
						|
    }
 | 
						|
}
 |