Skip to content

Commit

Permalink
[10.x] @session Blade Directive (#9223)
Browse files Browse the repository at this point in the history
* Add docs for @session blade directive

* Update blade.md

---------

Co-authored-by: Taylor Otwell <taylor@laravel.com>
  • Loading branch information
ahinkle and taylorotwell committed Dec 23, 2023
1 parent e3729a7 commit 8c435d1
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions blade.md
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,19 @@ You may use the `sectionMissing` directive to determine if a section does not ha
@endif
```

<a name="session-directives"></a>
#### Session Directives

The `@session` directive may be used to determine if a [session](/docs/{{version}}/session) value exists. If the session value exists, the template contents within the `@session` and `@endsession` directives will be evaluated. Within the `@session` directive's contents, you may echo the `$value` variable to display the session value:

```blade
@session('status')
<div class="p-4 bg-green-100">
{{ $value }}
</div>
@endsession
```

<a name="switch-statements"></a>
### Switch Statements

Expand Down

0 comments on commit 8c435d1

Please sign in to comment.