-
Notifications
You must be signed in to change notification settings - Fork 11.2k
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
[5.5] Blade @php directive #20994
Comments
@themsaid agh, I can see why. I'm working on it. |
@sileence thanks :) |
Shouldn't it be like this?
|
Closing as a no-fix. You can use regular PHP opening and closing tags. |
Add to documentation this info and to upgrade guide as well |
@jmarcher It appear |
As referenced in laravel/framework#20994 the inline `@php($teamMember = true)` blade directive is no longer supported. Instead recommend approach is to use full `@php` and `@endphp` template or revert to php tags.
|
@judgej It should not be working. |
@jmarcher Thanks. I'll put it down to an anomaly, and move to the block format before it stops working on the next update. |
I really wish this wasn't removed... |
Hey, can we at least see this added to the upgrade guide? Definitely unhelpful to end up here after nearly an hour of debugging an "Unexpected endforeach". Don't really understand why the single-line @php was removed, as it makes for much cleaner templates, but it should at least be clear in the guide, as I almost didn't catch this in testing, and followed the upgrade guide to the letter. |
The change was made in 5.5 and mentioned in the upgrade guide. There was a lot of discussion prior to the change due to numerous issues that were not practical to resolve. https://laravel.com/docs/5.5/upgrade |
Ah, my apologies. I must've missed while upgrading, because I was upgrading an angular app and probably skimmed the blade section. Sorry to waste your time! |
@Hazzard13 - I too like this shortcut format as it seems to be more simple. i usually use this in counting rows @php($counter=0) @foreach() @php($counter++) @Endforeach. Sad to know it's gone. thanks for this thread, as i was informed! |
From my experience, you can still use shorthanded |
i am actually using it on some of my blade files, but it is not working on some blade files, which is weird, that is why i searched on it, thus the reason why i arrived on this thread. knowing this, i think i shouldn't use it anymore to be safe. thank you for your reply. stay safe. |
Description:
Previously there was an ability to create php code with single line of using
@php
directive. Now I can't use it without@endphp
. I didn't see any mentions about it in Upgrade guide or documentation. Is it bug?Steps To Reproduce:
Try to create view with next code:
And you will get
The text was updated successfully, but these errors were encountered: