| Total Complexity | 2 |
| Total Lines | 37 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 11 | class Contact extends Model |
||
| 12 | { |
||
| 13 | use HasFactory; |
||
| 14 | use HasUUID; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * The attributes that are mass assignable. |
||
| 18 | * |
||
| 19 | * @var array |
||
| 20 | */ |
||
| 21 | protected $fillable = [ |
||
| 22 | 'name', |
||
| 23 | 'user_id', |
||
| 24 | 'source_type', |
||
| 25 | 'source_id', |
||
| 26 | ]; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * Scope a query to only include active users. |
||
| 30 | * |
||
| 31 | * @param \Illuminate\Database\Eloquent\Builder $query |
||
| 32 | * @param string $user_id |
||
| 33 | * @return \Illuminate\Database\Eloquent\Builder |
||
| 34 | */ |
||
| 35 | public function scopeForUser($query, $user_id) |
||
| 38 | } |
||
| 39 | |||
| 40 | /** |
||
| 41 | * Get the owner model of the contact. |
||
| 42 | * |
||
| 43 | * @return \Illuminate\Database\Eloquent\Relations\MorphTo |
||
| 44 | */ |
||
| 45 | public function source(): MorphTo |
||
| 50 |