-
-
Save JacobBennett/05d81d101920cba27a2a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class BaseModel extends Eloquent { | |
public function columns(){ | |
$table = $this->getTable(); | |
return DB::select(" SHOW COLUMNS FROM ".$table); | |
} | |
} | |
// other model | |
class OtherModel extends BaseModel{ | |
} | |
// controller | |
$table = new \OtherModel; | |
dd($table->columns()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment