Receipt.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. 'receipt_date',
  17. 'month',
  18. 'year',
  19. 'type',
  20. 'amount',
  21. 'commercial',
  22. 'status',
  23. 'parent'
  24. ];
  25. public function rows()
  26. {
  27. return $this->hasMany(ReceiptRow::class, 'receip_id', 'id');
  28. }
  29. public function record()
  30. {
  31. return $this->belongsTo(Record::class);
  32. }
  33. public function member()
  34. {
  35. return $this->belongsTo(Member::class);
  36. }
  37. public function supplier()
  38. {
  39. return $this->belongsTo(Supplier::class);
  40. }
  41. public function causal()
  42. {
  43. return $this->belongsTo(Causal::class);
  44. }
  45. public function payment_method()
  46. {
  47. return $this->belongsTo(PaymentMethod::class);
  48. }
  49. }