Explain findorFail method in Laravel ?

Sometimes you may wish to throw an exception if a specific record is not found. To do this, you may use the findOrFail method.in Laravel findOrFail methods and generates and exception if specific record is not found.

$model = User::findOrFail(1);

Leave a Reply

Your email address will not be published. Required fields are marked *