joedixon/laravel-translation error during installation in Laravel: Unsupported operand types

848 views Asked by At

I am facing this error while installing joedixon/laravel-translation library in my application. I tried many things I couldn't find any solution. Please help me here.


> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

   Symfony\Component\Debug\Exception\FatalThrowableError  : Unsupported operand types

  at /var/www/html/joedixon/vendor/joedixon/laravel-translation/routes/web.php:3
    1| <?php
    2| 
  > 3| Route::group(config('translation.route_group_config') + ['namespace' => 'JoeDixon\\Translation\\Http\\Controllers'], function ($router) {
    4|     $router->get(config('translation.ui_url'), 'LanguageController@index')
    5|         ->name('languages.index');
    6| 
    7|     $router->get(config('translation.ui_url').'/create', 'LanguageController@create')
    8|         ->name('languages.create');
    9| 

  Exception trace:

  1   require()
      /var/www/html/joedixon/vendor/laravel/framework/src/Illuminate/Support/ServiceProvider.php:78

  2   Illuminate\Support\ServiceProvider::loadRoutesFrom()
      /var/www/html/joedixon/vendor/joedixon/laravel-translation/src/TranslationServiceProvider.php:74

2

There are 2 answers

0
kbs1 On

Try removing the package, running php artisan optimize:clear, and installing it again. The package installs on fresh Laravel 8 project, but if you're are upgrading, I've also encountered this issue. Deleting all caches helped, the package then installed correctly.

0
Abdo Hazem On

in vendor\joedixon\laravel-translation\routes Add : use Illuminate\Support\Facades\Route; then run :composer require joedixon/laravel-translation