Skip to content

Commit

Permalink
Merge pull request #16 from fosron/patch-1
Browse files Browse the repository at this point in the history
Use Attribute Casting in Exception Model
  • Loading branch information
tylercd100 committed Mar 29, 2016
2 parents 7fb071a + 7d91f41 commit ef2329d
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/Models/ExceptionModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,14 @@
class ExceptionModel extends Model {
protected $table;
protected $guarded = array('id');


protected $casts = array(
'data' => 'array'
);

public function __construct(array $attributes = [])
{
$this->table = config('lern.record.table');
parent::__construct($attributes);
}

public function setDataAttribute($value) {
$this->attributes['data'] = json_encode($value);
}

public function getDataAttribute($value) {
return json_decode($value);
}
}
}

0 comments on commit ef2329d

Please sign in to comment.