Laravel Framework Lumen (7.0.3) (Laravel Components ^7.0)PHP 7.4.4 (cli) (built: Mar 17 2020 13:49:19) ( ZTS Visual C++ 2017 x64 )According to the documentation there are no differences between using views in Lumen and using views in Laravel and @auth and @guest directives should be available, but an exception is thrown. Guard is configured and Im able to use it in controllers with Auth::user()
Call to undefined function auth()
<?php if(auth()->guard()->check()): ?>
<?php endif; ?>
Create blade template with the following contents
@auth
<!-- test -->
@endauth
Did you install laravel/ui?
Hmm, actually that shouldn't be it. Did you run composer dump? Can you verify that the other helpers of the foundation helpers are loaded?
just tried
Using version ^2.0 for laravel/ui
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
- Installing laravel/ui (v2.0.1): Downloading (100%)
Writing lock file
Generating optimized autoload files
Didn't help.
Composer dump output
PS > composer dump
Generating optimized autoload files
Generated optimized autoload files containing 3244 classes
Its just a fresh clean lumen installation, any ideas?
I'm using this as a workaround now
@if (Auth::check())
<!-- test -->
@endif
But if @auth and @guest directives are not working this should be fixed or mentioned in the docs I guess. Or maybe I'm doing something wrong?
Sent in a PR for this: https://github.com/laravel/lumen-framework/pull/1068
Most helpful comment
Sent in a PR for this: https://github.com/laravel/lumen-framework/pull/1068