Answers for "Laravel check for constraint violation"

0

Laravel check for constraint violation

try {
  // ...

} catch (\Illuminate\Database\QueryException $e) {
    var_dump($e->errorInfo);
}

// Example output from MySQL
array (size=3)
   0 => string '23000' (length=5)
   1 => int 1452
   2 => string 'Cannot add or update a child row: a foreign key constraint fails (...)'
Posted by: Guest on June-17-2021

Code answers related to "Laravel check for constraint violation"

Browse Popular Code Answers by Language