Laravel catch errors and exception

Laravel catch errors and exception

Catch php exception in Laravel

try { 
    
} catch (\Exception $e) {
   return $e->getMessage();
}

Catch sql exception in Laravel

try { 
    
} catch(\Illuminate\Database\QueryException $ex){ 
  return $ex->getMessage();
}

click for more Laravel codes read about laravel exception handlers