public function checkUserIdentifier(Request $request) { $userIdentifier = $request->get('userIdentifier'); if ($this->organization->where('user_identifier', $userIdentifier)->count() == 0) { $response = ['status' => 'success', 'message' => 'The organization user identifier is available.']; } else { $response = ['status' => 'danger', 'message' => 'The organization user identifier has already been taken.']; } return $response; }
/** * check in DB if new reporting org is already present * @param $reportOrg * @return mixed */ public function getReportingOrganizations($reportOrg) { $result = Organization::where('id', '<>', session('org_id'))->whereRaw("reporting_org #>> '{0, reporting_organization_identifier}' = '" . $reportOrg['reporting_organization_identifier'] . "'"); return $result->first(); }