I want to make standard request for laravel localization file: animals.php
which looks like:
<?php
return [
'dog' => 'dog trans',
'cat' => 'cat trans',
'super-mutant-spider' => 'super-mutant-spider trans',
];
Now when I'm accessing this, I'm simply writing:
trans('animals.dog')
-> gives dog trans
etc.
this is fine,
now I want to make it depend on the user variable animal:
so when $user->animal
is 'dog' I want dog trans
result.
so when I try: trans('animals.$user->animal')
it will not work
How can I code it?