Skip to content

Commit

Permalink
fix outside cant use "use"
Browse files Browse the repository at this point in the history
  • Loading branch information
terranc committed Nov 5, 2019
1 parent 11a355c commit e81e276
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/AppendAutomateTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,21 @@

namespace Lookfeel\AppendAutomate;

use Lookfeel\AppendAutomate\Database\Eloquent\Concerns\HasAttributes;

trait AppendAutomateTrait
{
use HasAttributes;
protected function getArrayableAppends()
{
foreach ($this->appends as $k => $v) {
if (is_string($k)) {
$columns = explode('|', $k);
foreach ($columns as $column) {
if (!isset($this->$column)) {
unset($this->appends[$k]);
}
}
}
}

return parent::getArrayableAppends();
}
}

0 comments on commit e81e276

Please # to comment.