public function initialRows() { $table = $this->table_name; $columns = Schema::getColumnListing($table); foreach ($columns as $column) { if (0 != TableRow::where(['column_name' => $column])->count()) { continue; } TableRow::create(['table_name' => $table, 'column_name' => $column, 'type' => 'text', 'creatable' => true, 'editable' => true, 'listable' => true]); } //Delete unused columns TableRow::whereNotIn('column_name', $columns)->delete(); }