Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

rajoyish's avatar

The same code is working differently in different platform

Greeting Artisans! 🙏 I'm building a Laravel 9 application that I have hosted on two different hosting providers such as Linode & Cloud Shared Hosting for testing different things out. However the same code is working differently in different platform. Linode is working as expected, but Cloud Shared Hosting is not showing the result of the following code:

 <div class="sm:col-span-1">
                    <dt class="text-gray-500">Role</dt>
                    @if($user->role_id === 1)
                        <dd>
                            User
                        </dd>
                    @elseif($user->role_id === 2)
                        <dd>
                            Admin
                        </dd>
                    @endif
                </div>
0 likes
7 replies
martinbean's avatar

@rajoyish You need to actually tell us what’s happening, and what you’re expecting. We’re not clairvoyant, and can’t deduce what’s actually happening on your server(s) from a Blade template snippet.

Lara_Love's avatar
Level 6

hellow use it ==

 <div class="sm:col-span-1">
                    <dt class="text-gray-500">Role</dt>
                    @if($user->role_id == 1)
                        <dd>
                            User
                        </dd>
                    @elseif($user->role_id == 2)
                        <dd>
                            Admin
                        </dd>
                    @endif
                </div>
1 like
rajoyish's avatar

@Sinnbeck

Does it work in User.php?

protected $casts = [
        'role_id' => 'int',
        'is_verified' => 'boolean',
    ];

How do produce the same result in blade file?

Sinnbeck's avatar

@rajoyish if you just add that it should work (unless you are using DB::table())

1 like
Tray2's avatar

Does the shared hosting support php?

Please or to participate in this conversation.