-
Notifications
You must be signed in to change notification settings - Fork 11.4k
[12.x] Add @context
Blade directive
#56146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 12.x
Are you sure you want to change the base?
Conversation
@context
Blade directive
This is good and useful. The only problem that I see with it is the fact that the context has two data: normal and hidden, so it might be better to add an argument |
@devajmeireles It just delegates to the framework/src/Illuminate/Foundation/helpers.php Lines 332 to 350 in 6262237
|
I see, maybe we can adapt the helper before your PR to enable interaction with hidden values. |
@martinbean I just noticed we can interact with the hidden data even if we do not have the context()->has('foo');
context()->hasHidden('bar'); |
Adds a new
@context
Blade directive, that operates similar to the existing@session
directive.Context Directives
The @context directive may be used to determine if a context value exists. If the context value exists, the template contents within the
@context
and@endcontext
directives will be evaluated. Within the@context
directive’s contents, you may echo the$value
variable to display the context value:This makes it easy to check if a context value is set and if so, to obtain its value, in Blade templates. My particular use case: