Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
100.00% |
1 / 1 |
|
100.00% |
14 / 14 |
CRAP | |
100.00% |
14 / 14 |
| Waybill | |
100.00% |
1 / 1 |
|
100.00% |
14 / 14 |
20 | |
100.00% |
14 / 14 |
| owner | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| carrier | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| origination_city | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| destination_city | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| warehouse_weight_unit | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| carrier_weight_unit | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| carType | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| waybillAuditLogs | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| getOwnerNameAttribute | |
100.00% |
1 / 1 |
2 | |
100.00% |
1 / 1 |
|||
| getCarrierNameAttribute | |
100.00% |
1 / 1 |
2 | |
100.00% |
1 / 1 |
|||
| getOriginationCityNameAttribute | |
100.00% |
1 / 1 |
2 | |
100.00% |
1 / 1 |
|||
| getDestinationCityNameAttribute | |
100.00% |
1 / 1 |
2 | |
100.00% |
1 / 1 |
|||
| getWarehouseWeightUnitNameAttribute | |
100.00% |
1 / 1 |
2 | |
100.00% |
1 / 1 |
|||
| getCarrierWeightUnitNameAttribute | |
100.00% |
1 / 1 |
2 | |
100.00% |
1 / 1 |
|||
| <?php | |
| namespace App; | |
| use Illuminate\Database\Eloquent\Model; | |
| class Waybill extends Model | |
| { | |
| protected $fillable=[ | |
| 'status','type','waybill_number','owner_id','wms_bill_number','origination','destination','recipient','recipient_mobile','charge','ordering_remark', | |
| 'carrier_id','carrier_bill','origination_city_id','destination_city_id','warehouse_weight','warehouse_weight_unit_id','carrier_weight','carrier_weight_unit_id','carType_id', | |
| 'fee','pick_up_fee','other_fee','collect_fee','dispatch_remark' | |
| ]; | |
| protected $appends=[ | |
| 'origination_city_name', | |
| 'carrier_name', | |
| 'owner_name', | |
| 'destination_city_name', | |
| 'warehouse_weight_unit_name', | |
| 'carrier_weight_unit_name', | |
| ]; | |
| public function owner(){ | |
| return $this->belongsTo('App\Owner','owner_id','id'); | |
| } | |
| public function carrier(){ | |
| return $this->belongsTo('App\Carrier','carrier_id','id'); | |
| } | |
| public function origination_city(){ | |
| return $this->belongsTo('App\City','origination_city_id','id'); | |
| } | |
| public function destination_city(){ | |
| return $this->belongsTo('App\City','destination_city_id','id'); | |
| } | |
| public function warehouse_weight_unit(){ | |
| return $this->belongsTo('App\Unit','warehouse_weight_unit_id','id'); | |
| } | |
| public function carrier_weight_unit(){ | |
| return $this->belongsTo('App\Unit','carrier_weight_unit_id','id'); | |
| } | |
| public function carType(){ | |
| return $this->belongsTo('App\CarType','carType_id','id'); | |
| } | |
| public function waybillAuditLogs(){ | |
| return $this->hasMany('App\WaybillAuditLog','waybill_id','id'); | |
| } | |
| public function getOwnerNameAttribute(){ | |
| return $this['owner']? $this['owner']['name']:null; | |
| } | |
| public function getCarrierNameAttribute(){ | |
| return $this['carrier']? $this['carrier']['name']:null; | |
| } | |
| public function getOriginationCityNameAttribute(){ | |
| return $this['origination_city']? $this['origination_city']['name']:null; | |
| } | |
| public function getDestinationCityNameAttribute(){ | |
| return $this['destination_city']? $this['destination_city']['name']:null; | |
| } | |
| public function getWarehouseWeightUnitNameAttribute(){ | |
| return $this['warehouse_weight_unit']? $this['warehouse_weight_unit']['name']:null; | |
| } | |
| public function getCarrierWeightUnitNameAttribute(){ | |
| return $this['carrier_weight_unit']? $this['carrier_weight_unit']['name']:null; | |
| } | |
| } |