Laravel 4 with MySql db. For some reason, I cannot catch DB exceptions (Illuminate\\Database\\QueryException) inside a seed or migration class: the code nev
You must catch "Illuminate\Database\QueryException"
try { $data = array('id' => 1, 'name' => 'foo'); DB::table('table')->insert($data); } catch (\Illuminate\Database\QueryException $e) { $this->command->error("SQL Error: " . $e->getMessage() . "\n"); }