Total Complexity | 5 |
Total Lines | 30 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 0 |
1 | <?php |
||
7 | abstract class Revision extends BaseModel |
||
8 | { |
||
9 | public $timestamps = true; |
||
10 | |||
11 | protected $with = ['user']; |
||
12 | |||
13 | protected $fillable = [ |
||
14 | 'payload', |
||
15 | 'user_id', |
||
16 | ]; |
||
17 | |||
18 | public function __construct(array $attributes = []) |
||
19 | { |
||
20 | parent::__construct($attributes); |
||
21 | |||
22 | // Remember to update this if you had fields to the fillable array here |
||
23 | // this is to allow child classes to provide a custom foreign key in fillable |
||
24 | if (count($this->fillable) == 2) { |
||
25 | $this->fillable[] = strtolower(str_replace('Revision', '', get_called_class())) . '_id'; |
||
26 | } |
||
27 | } |
||
28 | |||
29 | public function user() |
||
32 | } |
||
33 | |||
34 | public function getByUserAttribute() |
||
37 | } |
||
38 | } |
||
39 |