| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <?php
- namespace App;
- use App\Traits\ModelTimeFormat;
- use Illuminate\Database\Eloquent\Model;
- use Illuminate\Database\Eloquent\Relations\HasMany;
- use App\Traits\ModelLogChanging;
- class Customer extends Model
- {
- use ModelLogChanging;
- use ModelTimeFormat;
- protected $fillable = [
- "code", //客户代码
- "name", //客户名称
- "company_name", //公司名称
- "invoice_address", //发票地址
- "contact_man", //联系人
- "phone", //联系电话
- "remark", //公司备注
- ];
- public function customerLogs(): HasMany
- {
- return $this->hasMany(CustomerLog::class,'customer_id','id');
- }
- public function owners()
- { //子项目
- return $this->hasMany(Owner::class,"customer_id","id");
- }
- public function tags()
- { //标签
- return $this->belongsToMany(CustomerTag::class,"customer_tag_customer");
- }
- }
|