lundi 31 juillet 2017

Laravel array in lang

Is it possible to get an array element from Laravel lang files?

For example if i have a following array under resources/lang/en/my.php:

<?php

return [
  'fruit' => [1 => 'apple', 2 => 'orange', 3 => 'whatever'],
];

and now under my blade view i want to display a fruit a user has chosen:

@lang('my.fruits')[2]

... but this doesn't work.

How to get the second element of that array in my view?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire