fork download
  1. <?php
  2.  
  3. $rows = [
  4. 0 => [
  5. 'device_id' => 3
  6. 'price' => 321312
  7. ],
  8. 1 => [
  9. 'device_id' => 1,
  10. 'price' => 1123
  11. ]
  12. ];
  13.  
  14. Validator::make($rows->toArray(), [
  15. '*.device_id' => ['required', 'integer', 'exists:App\Device,id', Rule::unique('prices')
  16. ->where('device_id', $rows['device_id'])
  17. ],
  18. '*.price' => ['required', 'numeric', 'min:0', 'max:16777215'],
  19. ])
  20. ->validate();
Runtime error #stdin #stdout #stderr 0.02s 24268KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
PHP Parse error:  syntax error, unexpected ''price'' (T_CONSTANT_ENCAPSED_STRING), expecting ']' in /home/XgYtH8/prog.php on line 6