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

teampoison's avatar

Banner are not showing when user are not login vue

i have one banner if i remove {{ member_profile.first_name }} {{ member_profile.last_name }} then banner are showing otherwise its hide for non login user

<div class="banner_section">
      <img
        class="banner_image"
        src="https://s3.ap-south-1.amazonaws.com/member-dev.tghclinic.com/website+stock+images/Stock+Photos/service_mian_image.jpeg"
        alt=""
      />
      <div class="banner_data_services">
        <span class="banner-text mb-2"
        style="text-transform: capitalize;"
          >Welcome  {{ member_profile.first_name }}
          {{ member_profile.last_name }}</span
        >
        <br />
        <span class="banner-heading"
          >Start your health transformation here</span
        >
      </div>
      <div class="banner_content"></div>
    </div>
0 likes
1 reply
LaryAI's avatar
Level 58

To show the banner for non-logged in users, you can check if the member_profile object exists before displaying the welcome message. Here's an example:

<div class="banner_section">
  <img
    class="banner_image"
    src="https://s3.ap-south-1.amazonaws.com/member-dev.tghclinic.com/website+stock+images/Stock+Photos/service_mian_image.jpeg"
    alt=""
  />
  <div class="banner_data_services">
    @if (isset($member_profile))
      <span class="banner-text mb-2" style="text-transform: capitalize;">
        Welcome {{ $member_profile->first_name }} {{ $member_profile->last_name }}
      </span>
    @endif
    <br />
    <span class="banner-heading">Start your health transformation here</span>
  </div>
  <div class="banner_content"></div>
</div>

In this example, we're using an @if statement to check if the $member_profile object exists. If it does, we display the welcome message with the user's first and last name. If it doesn't, we skip that part and only display the heading.

Note that this assumes that the $member_profile object is passed to the view from the controller. If it's not, you'll need to modify the code accordingly.

Please or to participate in this conversation.