Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Method Illuminate\Translation\Translator::getFromJson does not exist

Tags:

php

laravel

After upgrading from laravel 5.8 to laravel 6.0, I found this error.

Method Illuminate\Translation\Translator::getFromJson does not exist

Anyone know any work around for this?

It seems that problem is from using @lang for printing translation messages in my blade file

like image 203
Prasanth M P Avatar asked Sep 30 '19 06:09

Prasanth M P


2 Answers

Hy Prasanth

The Lang::get and Lang::getFromJson methods have been consolidated in laravel . Calls to the Lang::getFromJson method should be updated to call Lang::get.

You should run the php artisan view:clear Artisan command to avoid Blade errors related to the removal of Lang::transChoice, Lang::trans, and Lang::getFromJson.

Thank you.

like image 110
skm Avatar answered Nov 16 '22 20:11

skm


Try php artisan view:clear

The issue is that your view files have been compiled in 5.8, so @lang has compiled to Lang::getFromJson which has now been removed.

like image 37
chris_code Avatar answered Nov 16 '22 20:11

chris_code