A new @session blade directive #45786
Unanswered
gazmendsahiti
asked this question in
Ideas
Replies: 2 comments 2 replies
-
Also you could make your own custom directive, example public function boot()
{
Blade::if('session', function ($value) {
return session($value);
});
} |
Beta Was this translation helpful? Give feedback.
2 replies
-
This idea was implemented with #49339. 🙂 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have seen lots of code in different projects with a repeating
if(session('whatever')) or if(session()->has('whatever'))
, I have been thinking for some time that a @session directive should be shipped out of the box with Laravel.If I have the green light I would create the pull request.
Example:
@session('new_user') <x-welcome-banner/> @endsession
Beta Was this translation helpful? Give feedback.
All reactions