| Code Coverage
| Classes and Traits | Functions and Methods | Lines
Total | 100.00% covered (success) | 100.00% | 1 / 1 | 100.00% covered (success) | 100.00% | 14 / 14 | CRAP | 100.00% covered (success) | 100.00% | 14 / 14
Waybill | 100.00% covered (success) | 100.00% | 1 / 1 | 100.00% covered (success) | 100.00% | 14 / 14 | 20 | 100.00% covered (success) | 100.00% | 14 / 14
owner | 100.00% covered (success) | 100.00% | 1 / 1 | 1 | 100.00% covered (success) | 100.00% | 1 / 1
carrier | 100.00% covered (success) | 100.00% | 1 / 1 | 1 | 100.00% covered (success) | 100.00% | 1 / 1
origination_city | 100.00% covered (success) | 100.00% | 1 / 1 | 1 | 100.00% covered (success) | 100.00% | 1 / 1
destination_city | 100.00% covered (success) | 100.00% | 1 / 1 | 1 | 100.00% covered (success) | 100.00% | 1 / 1
warehouse_weight_unit | 100.00% covered (success) | 100.00% | 1 / 1 | 1 | 100.00% covered (success) | 100.00% | 1 / 1
carrier_weight_unit | 100.00% covered (success) | 100.00% | 1 / 1 | 1 | 100.00% covered (success) | 100.00% | 1 / 1
carType | 100.00% covered (success) | 100.00% | 1 / 1 | 1 | 100.00% covered (success) | 100.00% | 1 / 1
waybillAuditLogs | 100.00% covered (success) | 100.00% | 1 / 1 | 1 | 100.00% covered (success) | 100.00% | 1 / 1
getOwnerNameAttribute | 100.00% covered (success) | 100.00% | 1 / 1 | 2 | 100.00% covered (success) | 100.00% | 1 / 1
getCarrierNameAttribute | 100.00% covered (success) | 100.00% | 1 / 1 | 2 | 100.00% covered (success) | 100.00% | 1 / 1
getOriginationCityNameAttribute | 100.00% covered (success) | 100.00% | 1 / 1 | 2 | 100.00% covered (success) | 100.00% | 1 / 1
getDestinationCityNameAttribute | 100.00% covered (success) | 100.00% | 1 / 1 | 2 | 100.00% covered (success) | 100.00% | 1 / 1
getWarehouseWeightUnitNameAttribute | 100.00% covered (success) | 100.00% | 1 / 1 | 2 | 100.00% covered (success) | 100.00% | 1 / 1
getCarrierWeightUnitNameAttribute | 100.00% covered (success) | 100.00% | 1 / 1 | 2 | 100.00% covered (success) | 100.00% | 1 / 1

1 | <?php
2 |
3 | namespace App;
4 |
5 | use Illuminate\Database\Eloquent\Model;
6 |
7 | class Waybill extends Model
8 | {
9 |
10 | protected $fillable=[
11 | 'status','type','waybill_number','owner_id','wms_bill_number','origination','destination','recipient','recipient_mobile','charge','ordering_remark',
12 | 'carrier_id','carrier_bill','origination_city_id','destination_city_id','warehouse_weight','warehouse_weight_unit_id','carrier_weight','carrier_weight_unit_id','carType_id',
13 | 'fee','pick_up_fee','other_fee','collect_fee','dispatch_remark'
14 | ];
15 | protected $appends=[
16 | 'origination_city_name',
17 | 'carrier_name',
18 | 'owner_name',
19 | 'destination_city_name',
20 | 'warehouse_weight_unit_name',
21 | 'carrier_weight_unit_name',
22 | ];
23 |
24 | public function owner(){
25 | return $this->belongsTo('App\Owner','owner_id','id');
26 | }
27 | public function carrier(){
28 | return $this->belongsTo('App\Carrier','carrier_id','id');
29 | }
30 |
31 | public function origination_city(){
32 | return $this->belongsTo('App\City','origination_city_id','id');
33 | }
34 |
35 | public function destination_city(){
36 | return $this->belongsTo('App\City','destination_city_id','id');
37 | }
38 |
39 |
40 | public function warehouse_weight_unit(){
41 | return $this->belongsTo('App\Unit','warehouse_weight_unit_id','id');
42 | }
43 |
44 | public function carrier_weight_unit(){
45 | return $this->belongsTo('App\Unit','carrier_weight_unit_id','id');
46 | }
47 |
48 | public function carType(){
49 | return $this->belongsTo('App\CarType','carType_id','id');
50 | }
51 |
52 | public function waybillAuditLogs(){
53 | return $this->hasMany('App\WaybillAuditLog','waybill_id','id');
54 | }
55 |
56 |
57 | public function getOwnerNameAttribute(){
58 | return $this['owner']? $this['owner']['name']:null;
59 | }
60 | public function getCarrierNameAttribute(){
61 | return $this['carrier']? $this['carrier']['name']:null;
62 | }
63 | public function getOriginationCityNameAttribute(){
64 | return $this['origination_city']? $this['origination_city']['name']:null;
65 | }
66 |
67 | public function getDestinationCityNameAttribute(){
68 | return $this['destination_city']? $this['destination_city']['name']:null;
69 | }
70 | public function getWarehouseWeightUnitNameAttribute(){
71 | return $this['warehouse_weight_unit']? $this['warehouse_weight_unit']['name']:null;
72 | }
73 | public function getCarrierWeightUnitNameAttribute(){
74 | return $this['carrier_weight_unit']? $this['carrier_weight_unit']['name']:null;
75 | }
76 |
77 | }