Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dclarke-modus/3c86147546004889e06ed10ad4edb367 to your computer and use it in GitHub Desktop.
Save dclarke-modus/3c86147546004889e06ed10ad4edb367 to your computer and use it in GitHub Desktop.
select * from `blah`.`DataCapturePropertyInfo`
where `dataCaptureFormInfoID` = ? and exists
(select * from `blah`.`DataCapturePropertiesFields`
where `blah`.`DataCapturePropertyInfo`.`dataCapturePropertiesFieldID` = `blah`.`DataCapturePropertiesFields`.`dataCapturePropertiesFieldID`
and `fieldName` = ?)
public function apply($model, RepositoryInterface $repository)
{
$query = $model->whereHas('dataCapturePropertiesField', function($query)
{
$query->where("fieldName", "=", $this->section);
if ($this->section === FindByReportTypes::$ADDITIONAL_INFO)
{
$query->whereIn("section", $this->propertyReport);
}
});
return $query;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment