UnitPaymentAccount.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. /**
  7. * @property int $id
  8. * @property int $unit_id
  9. * @property string|null $asaas_api_key
  10. * @property string $status
  11. * @property \Illuminate\Support\Carbon|null $onboarded_at
  12. * @property \Illuminate\Support\Carbon|null $created_at
  13. * @property \Illuminate\Support\Carbon|null $updated_at
  14. * @property-read \App\Models\Unit $unit
  15. */
  16. class UnitPaymentAccount extends Model
  17. {
  18. use HasFactory;
  19. public const STATUS_PENDING = 'pending';
  20. public const STATUS_ACTIVE = 'active';
  21. protected $table = 'unit_payment_accounts';
  22. protected $guarded = ['id'];
  23. protected $casts = [
  24. // Cifra/decifra automaticamente usando a APP_KEY.
  25. 'asaas_api_key' => 'encrypted',
  26. 'onboarded_at' => 'datetime',
  27. 'created_at' => 'datetime',
  28. 'updated_at' => 'datetime',
  29. ];
  30. public function unit(): BelongsTo
  31. {
  32. return $this->belongsTo(Unit::class, 'unit_id');
  33. }
  34. }