| Total Complexity | 6 |
| Total Lines | 66 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 2 | Features | 0 |
| 1 | <?php |
||
| 11 | class People extends Model |
||
| 12 | { |
||
| 13 | use HasFactory; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * The attributes that should be mutated to dates. |
||
| 17 | * |
||
| 18 | * @var array |
||
| 19 | */ |
||
| 20 | protected $dates = ['deleted_at', 'updated_at', 'created_at']; |
||
| 21 | |||
| 22 | protected $table = 'people'; |
||
| 23 | protected $primaryKey = 'person_id'; |
||
| 24 | |||
| 25 | protected $fillable = [ |
||
| 26 | 'person_id', |
||
| 27 | 'name_first', |
||
| 28 | 'name_last', |
||
| 29 | 'email', |
||
| 30 | 'age', |
||
| 31 | ]; |
||
| 32 | |||
| 33 | /** |
||
| 34 | * Model Factory. |
||
| 35 | * |
||
| 36 | * @return PeopleFactory |
||
| 37 | */ |
||
| 38 | protected static function newFactory(): PeopleFactory |
||
| 39 | { |
||
| 40 | return new PeopleFactory(); |
||
| 41 | } |
||
| 42 | |||
| 43 | /** |
||
| 44 | * Query Builder. |
||
| 45 | * |
||
| 46 | * @param $query |
||
| 47 | * @return QueryBuilder |
||
| 48 | */ |
||
| 49 | public function newEloquentBuilder($query) |
||
| 52 | } |
||
| 53 | |||
| 54 | /** |
||
| 55 | * Query Builder method for improved type hinting. |
||
| 56 | * |
||
| 57 | * @return QueryBuilder|Builder |
||
| 58 | */ |
||
| 59 | public static function query() |
||
| 62 | } |
||
| 63 | |||
| 64 | public function getNameFullAttribute(): string |
||
| 65 | { |
||
| 66 | return "{$this->name_first} {$this->name_last}"; |
||
| 67 | } |
||
| 68 | |||
| 69 | public function getNameLastFirstAttribute(): string |
||
| 70 | { |
||
| 71 | return "{$this->name_last}, {$this->name_first}"; |
||
| 72 | } |
||
| 73 | |||
| 74 | public function getAgeAttribute($value): int |
||
| 77 | } |
||
| 78 | } |
||
| 79 |
Checks if undeclared accessed properties appear in database migrations and if the creating migration is correct.