Provider.php 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Factories\HasFactory;
  4. use Illuminate\Database\Eloquent\Model;
  5. use Illuminate\Database\Eloquent\Relations\BelongsTo;
  6. use Illuminate\Database\Eloquent\SoftDeletes;
  7. /**
  8. * @property int $id
  9. * @property string $document
  10. * @property string|null $rg
  11. * @property int $user_id
  12. * @property float|null $average_rating
  13. * @property int $total_services
  14. * @property string|null $birth_date
  15. * @property bool $selfie_verified
  16. * @property bool $document_verified
  17. * @property bool $is_approved
  18. * @property float|null $daily_price_8h
  19. * @property float|null $daily_price_6h
  20. * @property float|null $daily_price_4h
  21. * @property float|null $daily_price_2h
  22. * @property int|null $profile_media_id
  23. * @property \Illuminate\Support\Carbon|null $created_at
  24. * @property \Illuminate\Support\Carbon|null $updated_at
  25. * @property \Illuminate\Support\Carbon|null $deleted_at
  26. * @property-read \App\Models\User $user
  27. * @property-read \App\Models\Media|null $profileMedia
  28. * @method static \Illuminate\Database\Eloquent\Builder<static>|Provider newModelQuery()
  29. * @method static \Illuminate\Database\Eloquent\Builder<static>|Provider newQuery()
  30. * @method static \Illuminate\Database\Eloquent\Builder<static>|Provider onlyTrashed()
  31. * @method static \Illuminate\Database\Eloquent\Builder<static>|Provider query()
  32. * @method static \Illuminate\Database\Eloquent\Builder<static>|Provider withTrashed(bool $withTrashed = true)
  33. * @method static \Illuminate\Database\Eloquent\Builder<static>|Provider withoutTrashed()
  34. * @mixin \Eloquent
  35. */
  36. class Provider extends Model
  37. {
  38. use HasFactory, SoftDeletes;
  39. protected $table = "providers";
  40. protected $guarded = ["id"];
  41. /**
  42. * Get the attributes that should be cast.
  43. *
  44. * @return array<string, string>
  45. */
  46. protected function casts(): array
  47. {
  48. return [
  49. "birth_date" => "date",
  50. "selfie_verified" => "boolean",
  51. "document_verified" => "boolean",
  52. "is_approved" => "boolean",
  53. "average_rating" => "decimal:1",
  54. "daily_price_8h" => "decimal:2",
  55. "daily_price_6h" => "decimal:2",
  56. "daily_price_4h" => "decimal:2",
  57. "daily_price_2h" => "decimal:2",
  58. "total_services" => "integer",
  59. ];
  60. }
  61. /**
  62. * @return BelongsTo
  63. */
  64. public function user(): BelongsTo
  65. {
  66. return $this->belongsTo(User::class, "user_id");
  67. }
  68. /**
  69. * @return BelongsTo
  70. */
  71. public function profileMedia(): BelongsTo
  72. {
  73. return $this->belongsTo(Media::class, "profile_media_id");
  74. }
  75. }