You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Contact.php 1013B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. namespace App\Models\Common;
  3. use App\Concerns\Blamable;
  4. use App\Concerns\CompanyOwned;
  5. use App\Enums\Common\ContactType;
  6. use Database\Factories\Common\ContactFactory;
  7. use Illuminate\Database\Eloquent\Factories\Factory;
  8. use Illuminate\Database\Eloquent\Factories\HasFactory;
  9. use Illuminate\Database\Eloquent\Model;
  10. use Illuminate\Database\Eloquent\Relations\MorphTo;
  11. class Contact extends Model
  12. {
  13. use Blamable;
  14. use CompanyOwned;
  15. use HasFactory;
  16. protected $table = 'contacts';
  17. protected $fillable = [
  18. 'company_id',
  19. 'type',
  20. 'first_name',
  21. 'last_name',
  22. 'email',
  23. 'phones',
  24. 'is_primary',
  25. 'created_by',
  26. 'updated_by',
  27. ];
  28. protected $casts = [
  29. 'type' => ContactType::class,
  30. 'phones' => 'array',
  31. ];
  32. public function contactable(): MorphTo
  33. {
  34. return $this->morphTo();
  35. }
  36. protected static function newFactory(): Factory
  37. {
  38. return ContactFactory::new();
  39. }
  40. }