ReceiptRow.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. 'course_id',
  13. 'when',
  14. 'amount',
  15. 'note',
  16. 'commercial',
  17. 'aliquota_iva',
  18. 'imponibile',
  19. 'imposta',
  20. 'divisa',
  21. 'numero_linea',
  22. 'prezzo_unitario',
  23. 'quantita',
  24. 'prediscount_amount',
  25. 'sconto',
  26. 'subscription_id',
  27. ];
  28. protected $casts = [
  29. 'when' => 'json',
  30. 'aliquota_iva' => 'decimal:2',
  31. 'imponibile' => 'decimal:2',
  32. 'imposta' => 'decimal:2',
  33. 'prezzo_unitario' => 'decimal:2',
  34. 'quantita' => 'decimal:2',
  35. ];
  36. public function causal()
  37. {
  38. return $this->belongsTo(Causal::class);
  39. }
  40. public function receipt()
  41. {
  42. return $this->belongsTo(Receipt::class, 'receip_id', 'id');
  43. }
  44. public function course()
  45. {
  46. return $this->belongsTo(Course::class);
  47. }
  48. public function subscription()
  49. {
  50. return $this->belongsTo(Subscription::class, 'subscription_id');
  51. }
  52. }