samedi 29 septembre 2018

Why does my Laravel installation need prefixing \ backslash for facades aliases

I don't know the reason for malfunction of the following example:

Auth::user()->id 

However, just prefixing it with backslash makes it works fine:

\Auth::user()->id

This is a snippet from config/app.php

'aliases' => [

        'App' => Illuminate\Support\Facades\App::class,
        'Artisan' => Illuminate\Support\Facades\Artisan::class,
        'Auth' => Illuminate\Support\Facades\Auth::class,
        'Blade' => Illuminate\Support\Facades\Blade::class,
        'Broadcast' => Illuminate\Support\Facades\Broadcast::class,

The server is Apache on Ubuntu 16.04



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2NPv0o9
via IFTTT

Aucun commentaire:

Enregistrer un commentaire