ReceiptRow.php 1021 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. 'prediscount_amount',
  24. 'sconto',
  25. ];
  26. protected $casts = [
  27. 'when' => 'json',
  28. 'aliquota_iva' => 'decimal:2',
  29. 'imponibile' => 'decimal:2',
  30. 'imposta' => 'decimal:2',
  31. 'prezzo_unitario' => 'decimal:2',
  32. 'quantita' => 'decimal:2',
  33. ];
  34. public function causal()
  35. {
  36. return $this->belongsTo(Causal::class);
  37. }
  38. public function receipt()
  39. {
  40. return $this->belongsTo(Receipt::class, 'receip_id', 'id');
  41. }
  42. }