I want to run SQL script file in Laravel 5.5 and I use DB::unprepared($sql) which is good so far. But I found that DB::unprepared($sql) seems didn't return any error Exception. I try with different method but still didn't work.
Here some Exception class that I tried: \Exception, PDOException, \Illuminate\Database\QueryException, but didn't work.
Try tried get bolean return from DP::unprepared($sql) by doing this $return = DB::unprepared($sql); var_dump($return); but always return TRUE
I tried using DB::statement($sql), but it looks like use only for executing statement per statement. I need to run a whole sql file without any modification.
Could anyone help me how to catch any SQL script error? Any laravel function method that could help me catch SQL exception?