- API REST para gestion de facturas electronicas mexicanas (CFDI) - Laravel 9 con autenticacion OAuth 2.0 (Passport) - Integracion con Syntage, Clerk y Facturama - 30 modelos Eloquent, 39 controladores - Documentacion completa en /docs Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
63 lines
1.3 KiB
PHP
63 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class InvoiceLine extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'id'
|
|
];
|
|
|
|
public function invoice(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Invoice::class);
|
|
}
|
|
|
|
public function rfc(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Rfc::class);
|
|
}
|
|
|
|
public function invoiceType(): BelongsTo
|
|
{
|
|
return $this->belongsTo(InvoiceType::class);
|
|
}
|
|
|
|
public function paymentType(): BelongsTo
|
|
{
|
|
return $this->belongsTo(PaymentType::class);
|
|
}
|
|
|
|
public function issuerRfc(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Rfc::class);
|
|
}
|
|
|
|
public function receiverRfc(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Rfc::class);
|
|
}
|
|
|
|
public function getIssuerRfcAttribute()
|
|
{
|
|
return $this->issuerRfc()->first()->rfc;
|
|
}
|
|
|
|
public function getReceiverRfcAttribute()
|
|
{
|
|
return $this->receiverRfc()->first()->rfc;
|
|
}
|
|
|
|
protected $keyType = 'string';
|
|
|
|
protected $hidden = ['issuer_rfc_id', 'receiver_rfc_id'];
|
|
|
|
protected $appends = ['issuer_rfc', 'receiver_rfc'];
|
|
}
|