Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. class ModelXe{
  2.  
  3. protected $table = 'xxxxxx';
  4. public function __construct()
  5. {
  6. $listCol = DB::table('INFORMATION_SCHEMA.COLUMNS')
  7. ->select('COLUMN_NAME')
  8. ->where('TABLE_SCHEMA','=',env('DB_DATABASE'))
  9. ->where('TABLE_NAME','=',$this->table)->get();
  10. foreach($listCol as $colName){
  11. $c = $colName->COLUMN_NAME;
  12. $this->$c = null;
  13.  
  14. }
  15. }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement