laravel catch db exception code example
Example: laravel handle queryexception
try {
$this->model->create($data);
} catch (Illuminate\Database\QueryException $e) {
dd($e);
} catch (PDOException $e) {
dd($e);
}
try {
$this->model->create($data);
} catch (Illuminate\Database\QueryException $e) {
dd($e);
} catch (PDOException $e) {
dd($e);
}