I have tried to get all column names from a table Teller
Function:
public function getTableColumns($tables) { return DB::select(DB::raw('SELECT COLUMN_NAME, DATA_TYPE, COLUMN_DEFAULT FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = `Teller`')); }
You can get all columns name by simply doing that...
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\DB; public function getTableColumns($table) { return DB::getSchemaBuilder()->getColumnListing($table); // OR return Schema::getColumnListing($table); }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With