| Total Complexity | 2 |
| Total Lines | 49 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 2 | ||
| Bugs | 1 | Features | 1 |
| 1 | <?php |
||
| 8 | class Region extends Model |
||
| 9 | { |
||
| 10 | /***************************************************************************/ |
||
| 11 | /** |
||
| 12 | * The table associated with the model. |
||
| 13 | * |
||
| 14 | * @var string |
||
| 15 | */ |
||
| 16 | protected $table = 'regions'; |
||
| 17 | |||
| 18 | /***************************************************************************/ |
||
| 19 | |||
| 20 | use Translatable; |
||
|
|
|||
| 21 | |||
| 22 | public $translatedAttributes = ['name', 'slug']; |
||
| 23 | protected $fillable = ['country_id', 'timezone']; |
||
| 24 | public $useTranslationFallback = true; |
||
| 25 | |||
| 26 | /***************************************************************************/ |
||
| 27 | |||
| 28 | /* |
||
| 29 | * Return the region name. |
||
| 30 | * |
||
| 31 | * @param int $regionId |
||
| 32 | * @return string |
||
| 33 | */ |
||
| 34 | 1 | public static function getRegionName($regionId): string |
|
| 35 | { |
||
| 36 | 1 | $ret = self::find($regionId)->name; |
|
| 37 | |||
| 38 | 1 | return $ret; |
|
| 39 | } |
||
| 40 | |||
| 41 | /***************************************************************************/ |
||
| 42 | |||
| 43 | /** |
||
| 44 | * Return all the countries ordered by name. |
||
| 45 | * |
||
| 46 | * @return \Illuminate\Support\Collection |
||
| 47 | */ |
||
| 48 | 1 | public static function getRegionsByCountry($countryId) |
|
| 57 | } |
||
| 58 | } |
||
| 59 |