Skip to content

Commit

Permalink
Create Translator.php
Browse files Browse the repository at this point in the history
  • Loading branch information
wamesro authored Jan 23, 2023
1 parent b3de160 commit 69d80d7
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/Helpers/Translator.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

namespace Wame\Utils\Helpers;


class Translator
{
/**
* Translate array values
*
* e.g. Select filed options form config
* Select::make('example')
* ->options(Translator::arrayValue(config('wame.example'))
*
* @param array $list
*
* @return array
*/
public static function arrayValue($list)
{
return array_map(fn ($value) => __($value), $list);
}

}

0 comments on commit 69d80d7

Please sign in to comment.