vendorRepo = $vendorRepo; $this->ninjaRepo = $ninjaRepo; $this->datatableService = $datatableService; } protected function getRepo() { return $this->vendorRepo; } public function save($data, $vendor = null) { if (Auth::user()->account->isNinjaAccount() && isset($data['plan'])) { $this->ninjaRepo->updatePlanDetails($data['public_id'], $data); } return $this->vendorRepo->save($data, $vendor); } public function getDatatable($search) { $datatable = new VendorDatatable(); $query = $this->vendorRepo->find($search); if(!Utils::hasPermission('view_all')){ $query->where('vendors.user_id', '=', Auth::user()->id); } return $this->datatableService->createDatatable($datatable, $query); } }