argument('tables'); if (empty($tables)) { $this->error('No tables specified'); exit(); } $export_tables = []; foreach ($tables as $table) { $export_tables[$table] = []; $rows = DB::table($table)->get(); foreach ($rows as $row) { $export_tables[$table][] = (array) $row; } } $yaml = Yaml::dump($export_tables, 4, 2); echo $yaml; } }