fork download
  1. <?php
  2.  
  3. $attributeNames = ['good', 'bad', 'ugly'];
  4. $products = Product::where(function ($query) use ($attributeNames) {
  5. foreach ($attributeNames as $attr) {
  6. $query->whereHas('attributes', function ($query) use ($attr) {
  7. return $query->where('name', $attr);
  8. });
  9. }
  10. })->get();
Runtime error #stdin #stdout #stderr 0.02s 24176KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
PHP Fatal error:  Uncaught Error: Class 'Product' not found in /home/yuP897/prog.php:4
Stack trace:
#0 {main}
  thrown in /home/yuP897/prog.php on line 4