mapWithKeys(function ($table) { $tableName = array_values((array) $table)[0]; $columns = DB::select("DESCRIBE {$tableName}"); return [$tableName => $columns]; }) ->toArray(); return Response::text(json_encode($schema, JSON_PRETTY_PRINT)); } }