ssquare
6 months ago
537
4
Laravel

Validate if the combination of two columns is unique

Posted 6 months ago by ssquare

Model

id, before_hours, refund_percent, bus_id

In migration:

$table->unique(['before_hours', 'bus_id']);

I find that we can make sure if a column in unique or not by

'before_hours' => 'unique:refunds,before_hours'

But, how can I validate if the combination is unique

Please sign in or create an account to participate in this conversation.