Invoice.php 532 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. class Invoice extends Model
  5. {
  6. protected $table = "invoice";
  7. protected $guarded=['id'];
  8. function user()
  9. {
  10. return $this->belongsTo('App\User','created_by','id');
  11. }
  12. function items()
  13. {
  14. return $this->hasMany('App\Models\InvoiceItems','invoice_id');
  15. }
  16. function client()
  17. {
  18. return $this->belongsTo('App\User','client_id','id');
  19. }
  20. function company()
  21. {
  22. return $this->belongsTo('App\Models\CompanyModel','client_id','id');
  23. }
  24. }