<?php

Validator::make($rows->toArray(), [
    '*.device_id' => ['required', 'integer', 'exists:App\Device,id', Rule::unique('prices')
        ->where('device_id', $rows['device_id'])
    ],
    '*.price' => ['required', 'numeric', 'min:0', 'max:16777215'],
])
->validate();