I am looking to move a part of a session into a variable. The blade echo works fine outside the php tags. Inside the pgh tags I get an error about '{'.
Question: How can I move the mentioned session content into a PHP variable? If possible I would like to stay with using blade echo.
My code:
{{ session('payment.request_payment_id') }} // This works.
@php
$test = {{ session('payment.request_payment_id') }} // This shows error
@endphp
Error:
syntax error, unexpected '{' (View: Xxx.blade.php)