| 12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <?php
- namespace App;
- use App\Traits\ModelTimeFormat;
- use Carbon\Carbon;
- use Illuminate\Database\Eloquent\Model;
- use App\Traits\LogModelChanging;
- class OwnerReport extends Model
- {
- use LogModelChanging;
- use ModelTimeFormat;
- protected $fillable = [
- "owner_id", //货主ID
- "counting_month", //结算月
- "daily_average_order_amount", //日均单量
- "total", //总单量
- "current_month_counting_area", //结算月盘点面积
- "last_month_counting_area", //结算月上月盘点面积
- "owner_bill_report_id" //账单ID
- ];
- public $timestamps = false;
- public function owner()
- { //货主
- return $this->hasOne(Owner::class,"id","owner_id");
- }
- public function ownerBillReport()
- { //账单
- return $this->hasOne(OwnerBillReport::class,"id","owner_bill_report_id");
- }
- /* 结算月格式转换,仅截取至月
- * 引用:CreateOwnerReport
- */
- public function getCountingMonthAttribute($value)
- {
- return substr($value,0,7);
- }
- }
|