Add initial translations for enumerated values

This commit is contained in:
Nabeel Shahzad
2017-12-20 13:27:57 -06:00
parent e5278bc0bf
commit 3f8073e552
6 changed files with 46 additions and 16 deletions

View File

@@ -17,12 +17,16 @@ namespace App\Models\Enums;
class EnumBase
{
protected static $labels = [];
protected static $adverbs = [];
/**
* Return the label, try to return the translated version as well
* @param $value
* @return mixed
*/
public static function label($value) {
return self::$labels[$value];
if(isset(static::$labels[$value])) {
return trans(static::$labels[$value]);
}
}
}