title: Using ST_Intersects ST_Overlaps ST_within and ST_Equals at the same time
body: <p>Currently using Grimzy Laravel MySQL Spatial, but this is basically just converting it to proper SQL queries.</p>
  
  <p>I need to search whether an area intersects or overlaps or within or equal or contains to the polygon stored in DB.</p>
  
  <pre><code>public function __construct($areaPerimeterCoordinates = null)
  {
      $this-&gt;area = Polygon::fromJson($areaPerimeterCoordinates);
  }
  
  public function handle()
  {
      //this is the first query - it is working and returning result
      //need to refine it to check contains/same
      //$query = Property::intersects('area_perimeter', $this-&gt;area);  
  
      //working on this query - this returns empty
      $query = Property::where(function($qry) {
          $qry-&gt;intersects('area_perimeter', $this-&gt;area);
      })-&gt;orWhere(function($qry) {
          $qry-&gt;overlaps('area_perimeter', $this-&gt;area);
      })-&gt;orWhere(function($qry) {
          $qry-&gt;within('area_perimeter', $this-&gt;area);
      })-&gt;orWhere(function($qry) {
          $qry-&gt;equals('area_one_perimeter', $this-&gt;area);
      })-&gt;orWhere(function($qry) {
          $qry-&gt;contains('area_perimeter', $this-&gt;area);
      });
  
      $properties = $query-&gt;get();
  
      if(!$properties-&gt;isEmpty()) {
          throw new PropertyExistsException(null, $properties);
      }
  }
  </code></pre>
  
  <p>Note: As per checking the first query and editing it to use groupings by adding a closure, it also returns empty. Weird?</p>
  
  <pre><code>$query = Property::where(function($qry) {
      $qry-&gt;intersects('area_perimeter', $this-&gt;area);
  });
  
  $properties = $query-&gt;get();//empty
  </code></pre>
  
  <p>Additional note: Now this ST_intersect sometimes work and sometimes does not work... </p>
  
  <p>Really appreciate any advice. Thank you.</p>