Mohamed Irshath
Mohamed Irshath

Reputation: 1

Error while using "unique" validation in Laravel

I an having an issue in the line of code for the unique method in my Laravel rules.

I have a public property $lineId which will update when a user clicks on edit request.

public $lineId;

// This works perfectly.
'batch_number' =>'required|unique:App\Models\BatchNumber,batch_number,298',
    
// This is not working.
'batch_number' =>'required|unique:App\Models\BatchNumber,batch_number,'.$this->lineId.' ',

Upvotes: -1

Views: 39

Answers (0)

Related Questions