| Code Coverage
| Classes and Traits | Functions and Methods | Lines
Total | 100.00% covered (success) | 100.00% | 1 / 1 | 100.00% covered (success) | 100.00% | 8 / 8 | CRAP | 100.00% covered (success) | 100.00% | 8 / 8
WaybillPriceModel | 100.00% covered (success) | 100.00% | 1 / 1 | 100.00% covered (success) | 100.00% | 8 / 8 | 12 | 100.00% covered (success) | 100.00% | 8 / 8
carrier | 100.00% covered (success) | 100.00% | 1 / 1 | 1 | 100.00% covered (success) | 100.00% | 1 / 1
province | 100.00% covered (success) | 100.00% | 1 / 1 | 1 | 100.00% covered (success) | 100.00% | 1 / 1
city | 100.00% covered (success) | 100.00% | 1 / 1 | 1 | 100.00% covered (success) | 100.00% | 1 / 1
unit | 100.00% covered (success) | 100.00% | 1 / 1 | 1 | 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
getProvinceNameAttribute | 100.00% covered (success) | 100.00% | 1 / 1 | 2 | 100.00% covered (success) | 100.00% | 1 / 1
getCityNameAttribute | 100.00% covered (success) | 100.00% | 1 / 1 | 2 | 100.00% covered (success) | 100.00% | 1 / 1
getUnitNameAttribute | 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 WaybillPriceModel extends Model
8 | {
9 |
10 | protected $fillable=[
11 | 'carrier_id','province_id','city_id','unit_id','range_min','range_max','unit_price','initial_weight'
12 | ];
13 |
14 | protected $appends=[
15 | 'carrier_name',
16 | 'province_name',
17 | 'city_name',
18 | 'unit_name',
19 | ];
20 |
21 | public function carrier(){
22 | return $this->belongsTo('App\Carrier','carrier_id','id');
23 | }
24 |
25 | public function province(){
26 | return $this->belongsTo('App\Province','province_id','id');
27 | }
28 |
29 | public function city(){
30 | return $this->belongsTo('App\City','city_id','id');
31 | }
32 |
33 | public function unit(){
34 | return $this->belongsTo('App\Unit','unit_id','id');
35 | }
36 |
37 | public function getCarrierNameAttribute(){
38 | return $this['carrier']? $this['carrier']['name']:null;
39 | }
40 | public function getProvinceNameAttribute(){
41 | return $this['province']? $this['province']['name']:null;
42 | }
43 | public function getCityNameAttribute(){
44 | return $this['city']? $this['city']['name']:null;
45 | }
46 | public function getUnitNameAttribute(){
47 | return $this['unit']? $this['unit']['name']:null;
48 | }
49 | }