ARCANEDEV / Localization

:globe_with_meridians: Localization package for Laravel
MIT License
187 stars 37 forks source link

Non-static method Arcanedev\Localization\Localization::setLocale() should not be called statically #162

Closed hvostuho closed 3 years ago

hvostuho commented 3 years ago

Description:

Error Class 'Localization' not found Please tell me what am I doing wrong?

Steps To Reproduce:

  1. Install Laravel 8

  2. Install ARCANEDEV/Localization composer require arcanedev/localization

  3. Then do it. php artisan vendor:publish --provider="Arcanedev\Localization\LocalizationServiceProvider"

  4. Add to file app/Http/routes.php

    
    <?php
    use Arcanedev\Localization\Localization;
    use Illuminate\Support\Facades\Route;

Route::group([ 'prefix' => Localization::setLocale(), 'middleware' => [ 'localization-session-redirect', 'localization-redirect', ], ], function() { Route::get('/', function() { return view('welcome'); }); });



5. Refresh the page and see Error
**ErrorException
Non-static method Arcanedev\Localization\Localization::setLocale() should not be called statically**
arcanedev-maroc commented 3 years ago

You can use the localization() helper instead of Localization facade: localization()->setLocale()

Or the Real-Time Facades by using this namespace Facades\Arcanedev\Localization\Contracts\Localization instead of Arcanedev\Localization\Localization