Last active
March 23, 2017 12:44
-
-
Save kticka/1b960d2175d89de0cb36568f67aa4a73 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
trait Serializable | |
{ | |
protected static $vColumns = []; | |
public static function setVisibleColumns($columns = []) { | |
static::$vColumns = $columns; | |
} | |
public function toJson($options = 0) { | |
$this->setVisible(static::$vColumns); | |
return parent::toJson($options); | |
} | |
public function toArray() { | |
$this->setVisible(static::$vColumns); | |
return parent::toArray(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment