Issues (44)

app/Http/Middleware/SetupConfig.php (2 issues)

Labels
1
<?php
2
3
namespace App\Http\Middleware;
4
5
use Closure;
6
7
class SetupConfig
8
{
9
    /**
10
     * @param $request
11
     * @param \Closure $next
12
     *
13
     * @return mixed
14
     */
15
    public function handle($request, Closure $next)
16
    {
17
        if (app('auth')->user()) {
18
            app()->setLocale(app('auth')->user()->locale);
0 ignored issues
show
The method setLocale() does not exist on Illuminate\Container\Container. Are you sure you never get this type here, but always one of the subclasses? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

18
            app()->/** @scrutinizer ignore-call */ setLocale(app('auth')->user()->locale);
Loading history...
Accessing locale on the interface Illuminate\Contracts\Auth\Authenticatable suggest that you code against a concrete implementation. How about adding an instanceof check?
Loading history...
19
        }
20
21
        return $next($request);
22
    }
23
}
24