mistre83
2 years ago

Find or fail - Strange behaviour

Posted 2 years ago by mistre83

Hi to all, in my controller i have a find or fail with the input value:

$order = Order::findOrFail($order_id)

If $order_id do not exists, the function throw an exception, and is ok.

But, if i pass the following value (with an existing order):

  • 1234
  • 1234abc

in both case, the order is found (and the order is 1234)

If i pass a totally inexistent order (for example 345432, that do not exist), this this case the exception is raised

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