| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <?php
- namespace App;
- use Illuminate\Database\Eloquent\Model;
- use App\Traits\ModelLogChanging;
- class OwnerAreaReport extends Model
- {
- use ModelLogChanging;
- protected $fillable = [
- "owner_id", //货主ID
- "counting_month", //结算月
- "owner_storage_price_model_id", //仓储计费ID
- "user_owner_group_id", //项目组ID
- "area_on_tray", //货物整托
- "area_on_half_tray", //货物半托
- "area_on_flat", //平面区面积
- "accounting_area", //结算面积
- "status" //状态
- ];
- public function owner()
- { //货主
- return $this->hasOne(Owner::class,"id","owner_id");
- }
- public function userOwnerGroup()
- { //项目组
- return $this->hasOne(UserOwnerGroup::class,"id","user_owner_group_id");
- }
- public function ownerStoragePriceModel()
- { //仓储计费
- return $this->hasOne(OwnerStoragePriceModel::class,"id","owner_storage_price_model_id");
- }
- /* 结算月格式转换,仅截取至月
- * 引用:CreateOwnerReport
- */
- public function getCountingMonthAttribute($value)
- {
- return substr($value,0,7);
- }
- }
|