96386/how-to-select-all-column-name-from-a-table-in-laravel
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 this:
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\DB; public function getTableColumns($table) { return DB::getSchemaBuilder()->getColumnListing($table); // OR return Schema::getColumnListing($table); }
Hello @kartik, First, if you want to have ...READ MORE
Hello @kartik, The code below solved my problem: $messages ...READ MORE
Hello @kartik, There is a public getTable() method ...READ MORE
Hello @kartik, You can use less code, writing ...READ MORE
Hey @kartik, First you have to go to ...READ MORE
Named route is used to give specific ...READ MORE
Hello, This is simple you just need to ...READ MORE
Hey @kartik, Named routing is another amazing feature of ...READ MORE
You need do little modification in your ...READ MORE
Hello @kartik, There are date helpers available in ...READ MORE
OR
At least 1 upper-case and 1 lower-case letter
Minimum 8 characters and Maximum 50 characters
Already have an account? Sign in.