Client.php 1016 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Factories\HasFactory;
  4. use Illuminate\Database\Eloquent\Model;
  5. use Illuminate\Database\Eloquent\SoftDeletes;
  6. use Illuminate\Database\Eloquent\Relations\BelongsTo;
  7. use Illuminate\Database\Eloquent\Relations\HasMany;
  8. class Client extends Model
  9. {
  10. use HasFactory, SoftDeletes;
  11. protected $fillable = [
  12. 'document',
  13. 'user_id',
  14. ];
  15. protected $casts = [
  16. 'created_at' => 'datetime',
  17. 'updated_at' => 'datetime',
  18. 'deleted_at' => 'datetime',
  19. ];
  20. /**
  21. * @return BelongsTo
  22. */
  23. public function user(): BelongsTo
  24. {
  25. return $this->belongsTo(User::class);
  26. }
  27. /**
  28. * @return HasMany
  29. */
  30. public function blockedByProviders(): HasMany
  31. {
  32. return $this->hasMany(ProviderClientBlock::class);
  33. }
  34. /**
  35. * @return HasMany
  36. */
  37. public function blockedProviders(): HasMany
  38. {
  39. return $this->hasMany(ClientProviderBlock::class);
  40. }
  41. }