php - Laravel 5 Lang::get() Replace -
i'm having problems.
you can use lang :: () in laravel 5, want make replace characters.
resources/lang/en/messages.php
<?php return array( 'test' => 'test message. :name',
views/top.blade.php
{!! app::setlocale('en') !!} {!! lang::get('messages.test', array('name' => 'dayle')) !!}
however, error.
errorexception in translator.php line 148: missing argument 2 illuminate\translation\translator::illuminate\translation\{closure}(), called in /home/my-site/www/my-site/vendor/compiled.php on line 11547 , defined (view: /home/my-site/www/my-site/resources/views/top.blade.php)
cause not know.
do not people know?
i resolve issue following steps here
to summarize, try following steps:
- delete vendor/compiled.php , storage/framework/compiled.php
- run
composer update
, if didn't run automatically, runphp artisan optimise
compile again. - use double quotes in messages.php file (e.g.
"title" => "value in double qoutes"
) - run
composer dump-autoload -o