| Total Complexity | 7 |
| Total Lines | 40 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 9 | class BaseClearModel extends Model |
||
| 10 | { |
||
| 11 | //scopes |
||
| 12 | public function scopeActive($query) |
||
| 13 | { |
||
| 14 | return $query->where('active', true); |
||
| 15 | } |
||
| 16 | |||
| 17 | public function scopeDraft($query) |
||
| 18 | { |
||
| 19 | return $query->where('active', false); |
||
| 20 | } |
||
| 21 | |||
| 22 | public function creators() |
||
| 23 | { |
||
| 24 | return $this->belongsTo(User::class, 'created_by', 'id') |
||
| 25 | ->withDefault(['name' => '-']); |
||
| 26 | } |
||
| 27 | |||
| 28 | public function editors() |
||
| 29 | { |
||
| 30 | return $this->belongsTo(User::class, 'modifed_by', 'id') |
||
| 31 | ->withDefault(['name' => '-']); |
||
| 32 | } |
||
| 33 | |||
| 34 | //observers |
||
| 35 | public static function boot() |
||
| 49 | } |
||
| 50 | }); |
||
| 51 | } |
||
| 52 | } |
||
| 53 |