Customer.php 787 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace App;
  3. use App\Traits\ModelTimeFormat;
  4. use Illuminate\Database\Eloquent\Model;
  5. use Illuminate\Database\Eloquent\Relations\HasMany;
  6. class Customer extends Model
  7. {
  8. use ModelTimeFormat;
  9. protected $fillable = [
  10. "code", //客户代码
  11. "name", //客户名称
  12. "company_name", //公司名称
  13. "invoice_address", //发票地址
  14. "contact_man", //联系人
  15. "phone", //联系电话
  16. "remark", //公司备注
  17. ];
  18. public function customerLogs(): HasMany
  19. {
  20. return $this->hasMany(CustomerLog::class,'customer_id','id');
  21. }
  22. public function owners()
  23. { //子项目
  24. return $this->hasMany(Owner::class,"customer_id","id");
  25. }
  26. }