Skip to content

Instantly share code, notes, and snippets.

@isaqueprofeta
Created January 24, 2018 19:15
Show Gist options
  • Save isaqueprofeta/d2ad925704570a4be567fbd3893cb74e to your computer and use it in GitHub Desktop.
Save isaqueprofeta/d2ad925704570a4be567fbd3893cb74e to your computer and use it in GitHub Desktop.
<?php
use Illuminate\Support\Facades\DB;
$query = "SELECT tables.table_name, columns.column_name, columns.data_type, columns.udt_name FROM information_schema.tables AS tables JOIN information_schema.columns AS columns ON tables.table_name = columns.table_name WHERE tables.table_type = 'BASE TABLE' AND tables.table_schema NOT IN ('pg_catalog', 'information_schema')";
$data = json_decode(collect(DB::select($query)));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment