Traits with PHP and Laravel
问题 I am using Laravel 5.1 and would like to access an array on the Model from the Trait when the Model before the model uses the appends array. I would like to add certain items to the appends array if it exists from my trait. I don't want to edit the model in order to achieve this. Are traits actually usable in this scenario or should I use inheritance? array_push($this->appends, 'saucedByCurrentUser'); Here is how my current setup works. Trait <?php namespace App; trait AwesomeSauceTrait { /**