当我运行服务器时,它当前给我这个错误
Trait 'Larapen\LaravelLocalization\LocalizationTrait' not found but I solve it by written
use App\Http\Controllers\Traits\LocalizationTrait; in LaravelLocalization.php file 但这导致了另一个问题:服务器正在工作,但如果打开brwser路由器是"http://127.0.0.1:8000/en/countries“,页面不工作,并显示错误消息:
[Tue Oct 6 11:46:24 2020] PHP Fatal error: Uncaught Error: Call to undefined method Larapen\LaravelLocalization\LaravelLocalization::exceptRedirectionPath() in C:\xampp\htdocs\shobbeek\packages\mcamara\laravel-localization\src\Larapen\LaravelLocalization\LaravelLocalization.php:273
Stack trace:
#0 C:\xampp\htdocs\shobbeek\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php(261): Larapen\LaravelLocalization\LaravelLocalization->getLocalizedURL('de', NULL, Array)
#1 C:\xampp\htdocs\shobbeek\app\Helpers\Functions\core.php(398): Illuminate\Support\Facades\Facade::__callStatic('getLocalizedURL', Array)
#2 C:\xampp\htdocs\shobbeek\storage\framework\views\3d0f194ac9896b9a0f4a0976c680d46f6dc16cc6.php(224): lurl(NULL, Array, 'de')
#3 C:\xampp\htdocs\shobbeek\vendor\laravel\framework\src\Illuminate\View\Engines\PhpEngine.php(41): include('C:\\xampp\\htdocs...')
#4 C:\xampp\htdocs\shobbeek\vendor\laravel\framework\src\Illuminate\View\Engines\CompilerEngine.php(57): Illuminate\View\Engines\PhpEngine->evaluatePath('C:\\xampp\\htdocs...', Array)
#5 C in C:\xampp\htdocs\shobbeek\packages\mcamara\laravel-localization\src\Larapen\LaravelLocalization\LaravelLocalization.php on line 273
[Tue Oct 6 11:46:24 2020] PHP Fatal error: Uncaught Error: Call to undefined method Larapen\LaravelLocalization\LaravelLocalization::exceptRedirectionPath() in C:\xampp\htdocs\shobbeek\packages\mcamara\laravel-localization\src\Larapen\LaravelLocalization\LaravelLocalization.php:273
Stack trace:
#0 C:\xampp\htdocs\shobbeek\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php(261): Larapen\LaravelLocalization\LaravelLocalization->getLocalizedURL('de', NULL, Array)
#1 C:\xampp\htdocs\shobbeek\app\Helpers\Functions\core.php(398): Illuminate\Support\Facades\Facade::__callStatic('getLocalizedURL', Array)
#2 C:\xampp\htdocs\shobbeek\storage\framework\views\3d0f194ac9896b9a0f4a0976c680d46f6dc16cc6.php(224): lurl(NULL, Array, 'de')
#3 C:\xampp\htdocs\shobbeek\vendor\laravel\framework\src\Illuminate\View\Engines\PhpEngine.php(41): include('C:\\xampp\\htdocs...')
#4 C:\xampp\htdocs\shobbeek\vendor\laravel\framework\src\Illuminate\View\Engines\CompilerEngine.php(57): Illuminate\View\Engines\PhpEngine->evaluatePath('C:\\xampp\\htdocs...', Array)
#5 C in C:\xampp\htdocs\shobbeek\packages\mcamara\laravel-localization\src\Larapen\LaravelLocalization\LaravelLocalization.php on line 273发布于 2021-08-15 00:27:32
我找到了这个答案,它帮助了我。
它讨论了如何在route.php文件中导入facade
<PHP
use \Mcamara\LaravelLocalization\Facades\LaravelLocalization;
... the rest of the code ...希望它能帮助你:
https://github.com/mcamara/laravel-localization/issues/485#issuecomment-327246445
https://stackoverflow.com/questions/64222521
复制相似问题