ReceiptRow.php 972 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Factories\HasFactory;
  4. use Illuminate\Database\Eloquent\Model;
  5. class ReceiptRow extends Model
  6. {
  7. use HasFactory;
  8. protected $table = 'receipts_rows';
  9. protected $fillable = [
  10. 'receip_id',
  11. 'causal_id',
  12. 'when',
  13. 'amount',
  14. 'note',
  15. 'commercial',
  16. 'aliquota_iva',
  17. 'imponibile',
  18. 'imposta',
  19. 'divisa',
  20. 'numero_linea',
  21. 'prezzo_unitario',
  22. 'quantita'
  23. ];
  24. protected $casts = [
  25. 'when' => 'json',
  26. 'aliquota_iva' => 'decimal:2',
  27. 'imponibile' => 'decimal:2',
  28. 'imposta' => 'decimal:2',
  29. 'prezzo_unitario' => 'decimal:2',
  30. 'quantita' => 'decimal:2',
  31. ];
  32. public function causal()
  33. {
  34. return $this->belongsTo(Causal::class);
  35. }
  36. public function receipt()
  37. {
  38. return $this->belongsTo(Receipt::class, 'receip_id', 'id');
  39. }
  40. }