Receipt.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Factories\HasFactory;
  4. use Illuminate\Database\Eloquent\Model;
  5. class Receipt extends Model
  6. {
  7. use HasFactory;
  8. protected $fillable = [
  9. 'record_id',
  10. 'member_id',
  11. 'supplier_id',
  12. 'causal_id',
  13. 'payment_method_id',
  14. 'number',
  15. 'date',
  16. 'month',
  17. 'year',
  18. 'type',
  19. 'amount',
  20. 'commercial',
  21. 'status',
  22. 'parent'
  23. ];
  24. public function rows()
  25. {
  26. return $this->hasMany(ReceiptRow::class, 'receip_id', 'id');
  27. }
  28. public function record()
  29. {
  30. return $this->belongsTo(Record::class);
  31. }
  32. public function member()
  33. {
  34. return $this->belongsTo(Member::class);
  35. }
  36. public function supplier()
  37. {
  38. return $this->belongsTo(Supplier::class);
  39. }
  40. public function causal()
  41. {
  42. return $this->belongsTo(Causal::class);
  43. }
  44. public function payment_method()
  45. {
  46. return $this->belongsTo(PaymentMethod::class);
  47. }
  48. }