| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- <?php
- namespace App\Models;
- use Illuminate\Database\Eloquent\Factories\HasFactory;
- use Illuminate\Database\Eloquent\Model;
- use Illuminate\Database\Eloquent\SoftDeletes;
- /**
- * @property int $id
- * @property string $name
- * @property \Carbon\Carbon $created_at
- * @property \Carbon\Carbon $updated_at
- */
- class Payment extends Model
- {
- use HasFactory, SoftDeletes;
- protected $table = 'payments';
- protected $fillable = [
- 'schedule_id',
- 'client_id',
- 'provider_id',
- 'client_payment_method_id',
- 'gateway_provider',
- 'gateway_entity_reference',
- 'gateway_entity_label',
- 'gateway_operation_reference',
- 'gateway_operation_label',
- 'payment_method',
- 'status',
- 'gross_amount',
- 'gateway_fee_amount',
- 'platform_fee_amount',
- 'net_amount',
- 'currency',
- 'installments',
- 'authorized_at',
- 'paid_at',
- 'failed_at',
- 'cancelled_at',
- 'expires_at',
- 'failure_code',
- 'failure_message',
- 'gateway_payload',
- 'metadata',
- ];
- protected $casts = [
- 'gross_amount' => 'decimal:2',
- 'gateway_fee_amount' => 'decimal:2',
- 'platform_fee_amount' => 'decimal:2',
- 'net_amount' => 'decimal:2',
- 'installments' => 'integer',
- 'authorized_at' => 'datetime',
- 'paid_at' => 'datetime',
- 'failed_at' => 'datetime',
- 'cancelled_at' => 'datetime',
- 'expires_at' => 'datetime',
- 'gateway_payload' => 'array',
- 'metadata' => 'array',
- 'created_at' => 'datetime',
- 'updated_at' => 'datetime',
- 'deleted_at' => 'datetime',
- ];
- public function schedule()
- {
- return $this->belongsTo(Schedule::class);
- }
- public function client()
- {
- return $this->belongsTo(Client::class);
- }
- public function provider()
- {
- return $this->belongsTo(Provider::class);
- }
- public function clientPaymentMethod()
- {
- return $this->belongsTo(ClientPaymentMethod::class);
- }
- public function transfers()
- {
- return $this->hasMany(PaymentTransfer::class);
- }
- }
|