Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| ShippingZone | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| auditName | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| rates | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Models; |
| 4 | |
| 5 | use App\Support\Auditable; |
| 6 | use Illuminate\Database\Eloquent\Model; |
| 7 | |
| 8 | class ShippingZone extends Model |
| 9 | { |
| 10 | use Auditable; |
| 11 | |
| 12 | protected $fillable = ['name', 'areas', 'is_international', 'cod_allowed', 'is_active', 'sort_order']; |
| 13 | |
| 14 | protected $casts = [ |
| 15 | 'is_international' => 'boolean', |
| 16 | 'cod_allowed' => 'boolean', |
| 17 | 'is_active' => 'boolean', |
| 18 | 'sort_order' => 'integer', |
| 19 | ]; |
| 20 | |
| 21 | protected function auditName(): string |
| 22 | { |
| 23 | return 'shipping_zone'; |
| 24 | } |
| 25 | |
| 26 | public function rates() |
| 27 | { |
| 28 | return $this->hasMany(ShippingRate::class, 'zone_id')->orderBy('sort_order'); |
| 29 | } |
| 30 | } |