App\services\PaymentService::getDatatable PHP Method

getDatatable() public method

public getDatatable ( $clientPublicId, $search )
    public function getDatatable($clientPublicId, $search)
    {
        $datatable = new PaymentDatatable(!$clientPublicId, $clientPublicId);
        $query = $this->paymentRepo->find($clientPublicId, $search);
        if (!Utils::hasPermission('view_all')) {
            $query->where('payments.user_id', '=', Auth::user()->id);
        }
        return $this->datatableService->createDatatable($datatable, $query);
    }

Usage Example

 /**
  * @param null $clientPublicId
  * @return \Illuminate\Http\JsonResponse
  */
 public function getDatatable($clientPublicId = null)
 {
     return $this->paymentService->getDatatable($clientPublicId, Input::get('sSearch'));
 }