If statement not presenting the else resultmysql_fetch_array()/mysql_fetch_assoc()/mysql_fetch_row()/mysql_num_rows etc… expects parameter 1 to be resource or resultClient Credit Management with IF and ELSE statementIn Laravel, the best way to pass different types of flash messages in the sessionCSRF (Cross Site Request Forgery) does not work as expected in LaravelLaravel 5.3 Form post error session store not set on requestLaravel - Display form results on the same page after mutliple forms submitWhy is my validation on my Laravel form failing and routing to a different page?Put if conditions in route laravelDynamic form not sending all valuesHow to insert/post data in laravel using ajax into Database by query builder method without using model

Draw the ☣ (Biohazard Symbol)

Professor refuses to write a recommendation letter to students who haven't written a research paper with him

Why did Boris Johnson call for new elections?

Are there mathematical concepts that exist in the fourth dimension, but not in the third dimension?

Does POSIX guarantee the paths to any standard utilities?

Is the Levitate spell supposed to basically disable a melee-based enemy?

How does the UK House of Commons think they can prolong the deadline of Brexit?

What fraction of 2x2 USA call signs are vanity calls?

Undefined Hamiltonian for this particular Lagrangian

Is there any reason to change the ISO manually?

Fantasy Military Arms and Armor: the Dwarven Grand Armory

French equivalent of "my cup of tea"

What quests do you need to stop at before you make an enemy of a faction for each faction?

What's the eccentricity of an orbit (trajectory) falling straight down towards the center?

Regex pattern matching cursor-position

RAW, Is the "Finesse" trait incompatible with unarmed attacks?

Was "The Hobbit" ever abridged?

Why there are construction cranes on apparently completed buildings in New York?

Is a paralyzed creature limp or rigid?

Do I have to rename all creatures in a new world?

If I sell my PS4 game disc and buy a digital version, can I still access my saved game?

Bidirectional Dictionary

How can I oppose my advisor granting gift authorship to a collaborator?

Dissuading my girlfriend from a scam



If statement not presenting the else result


mysql_fetch_array()/mysql_fetch_assoc()/mysql_fetch_row()/mysql_num_rows etc… expects parameter 1 to be resource or resultClient Credit Management with IF and ELSE statementIn Laravel, the best way to pass different types of flash messages in the sessionCSRF (Cross Site Request Forgery) does not work as expected in LaravelLaravel 5.3 Form post error session store not set on requestLaravel - Display form results on the same page after mutliple forms submitWhy is my validation on my Laravel form failing and routing to a different page?Put if conditions in route laravelDynamic form not sending all valuesHow to insert/post data in laravel using ajax into Database by query builder method without using model






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















The else section of my code is not being displayed in my laravel blade. I need to get the else section of the statement to show. currently, that button is missing when the if statement is false.



@auth
@if(optional($quote->userLike))
@foreach($quote->userLike as $like)
@if($like->pivot->user_id == $id) //passing user id from controller here
<li class="list-inline-item">
<form method="POST" action="route('likequote')" class="likequote">
@csrf
<input type="hidden" class="form-control col-md-4" name="likequote" id="likequote" value='$quote->id'>
<button type="submit" class="btn btn-danger shadow-lg " id="savelike"><i class="fas fa-heart"></button></i>
</form>
</li>
@endif
@endforeach
@else
<li class="list-inline-item">
<form method="POST" action="route('likequote')" class="likequote">
@csrf
<input type="hidden" class="form-control col-md-4" name="likequote" id="likequote" value='$quote->id'>
<button type="submit" class="btn btn-primary shadow-lg " id="savelike"><i class="fas fa-heart"></button></i>
</form>
</li>
@endif
@endauth










share|improve this question
































    1















    The else section of my code is not being displayed in my laravel blade. I need to get the else section of the statement to show. currently, that button is missing when the if statement is false.



    @auth
    @if(optional($quote->userLike))
    @foreach($quote->userLike as $like)
    @if($like->pivot->user_id == $id) //passing user id from controller here
    <li class="list-inline-item">
    <form method="POST" action="route('likequote')" class="likequote">
    @csrf
    <input type="hidden" class="form-control col-md-4" name="likequote" id="likequote" value='$quote->id'>
    <button type="submit" class="btn btn-danger shadow-lg " id="savelike"><i class="fas fa-heart"></button></i>
    </form>
    </li>
    @endif
    @endforeach
    @else
    <li class="list-inline-item">
    <form method="POST" action="route('likequote')" class="likequote">
    @csrf
    <input type="hidden" class="form-control col-md-4" name="likequote" id="likequote" value='$quote->id'>
    <button type="submit" class="btn btn-primary shadow-lg " id="savelike"><i class="fas fa-heart"></button></i>
    </form>
    </li>
    @endif
    @endauth










    share|improve this question




























      1












      1








      1








      The else section of my code is not being displayed in my laravel blade. I need to get the else section of the statement to show. currently, that button is missing when the if statement is false.



      @auth
      @if(optional($quote->userLike))
      @foreach($quote->userLike as $like)
      @if($like->pivot->user_id == $id) //passing user id from controller here
      <li class="list-inline-item">
      <form method="POST" action="route('likequote')" class="likequote">
      @csrf
      <input type="hidden" class="form-control col-md-4" name="likequote" id="likequote" value='$quote->id'>
      <button type="submit" class="btn btn-danger shadow-lg " id="savelike"><i class="fas fa-heart"></button></i>
      </form>
      </li>
      @endif
      @endforeach
      @else
      <li class="list-inline-item">
      <form method="POST" action="route('likequote')" class="likequote">
      @csrf
      <input type="hidden" class="form-control col-md-4" name="likequote" id="likequote" value='$quote->id'>
      <button type="submit" class="btn btn-primary shadow-lg " id="savelike"><i class="fas fa-heart"></button></i>
      </form>
      </li>
      @endif
      @endauth










      share|improve this question
















      The else section of my code is not being displayed in my laravel blade. I need to get the else section of the statement to show. currently, that button is missing when the if statement is false.



      @auth
      @if(optional($quote->userLike))
      @foreach($quote->userLike as $like)
      @if($like->pivot->user_id == $id) //passing user id from controller here
      <li class="list-inline-item">
      <form method="POST" action="route('likequote')" class="likequote">
      @csrf
      <input type="hidden" class="form-control col-md-4" name="likequote" id="likequote" value='$quote->id'>
      <button type="submit" class="btn btn-danger shadow-lg " id="savelike"><i class="fas fa-heart"></button></i>
      </form>
      </li>
      @endif
      @endforeach
      @else
      <li class="list-inline-item">
      <form method="POST" action="route('likequote')" class="likequote">
      @csrf
      <input type="hidden" class="form-control col-md-4" name="likequote" id="likequote" value='$quote->id'>
      <button type="submit" class="btn btn-primary shadow-lg " id="savelike"><i class="fas fa-heart"></button></i>
      </form>
      </li>
      @endif
      @endauth







      php laravel laravel-5






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 28 at 6:03









      Akash Kumar Verma

      1,2842 gold badges5 silver badges17 bronze badges




      1,2842 gold badges5 silver badges17 bronze badges










      asked Mar 28 at 4:22









      Davinchi1Davinchi1

      105 bronze badges




      105 bronze badges

























          2 Answers
          2






          active

          oldest

          votes


















          0
















          • first method

          @auth
          @forelse($quote->userLike as $like)
          @if($like->pivot->user_id == $id) //passing user id from controller here
          <li class="list-inline-item">
          <form method="POST" action="route('likequote')" class="likequote">
          @csrf
          <input type="hidden" class="form-control col-md-4" name="likequote" id="likequote" value='$quote->id'>
          <button type="submit" class="btn btn-danger shadow-lg " id="savelike"><i class="fas fa-heart"></button></i>
          </form>
          </li>
          @endif
          @empty
          <li class="list-inline-item">
          <form method="POST" action="route('likequote')" class="likequote">
          @csrf
          <input type="hidden" class="form-control col-md-4" name="likequote" id="likequote" value='$quote->id'>
          <button type="submit" class="btn btn-primary shadow-lg " id="savelike"><i class="fas fa-heart"></button></i>
          </form>
          </li>
          @endforelse
          @endauth


          • Second

          @auth
          @if(!empty($quote->userLike) && count($quote->userLike)>0)
          @foreach($quote->userLike as $like)
          @if($like->pivot->user_id == $id) //passing user id from controller here
          <li class="list-inline-item">
          <form method="POST" action="route('likequote')" class="likequote">
          @csrf
          <input type="hidden" class="form-control col-md-4" name="likequote" id="likequote" value='$quote->id'>
          <button type="submit" class="btn btn-danger shadow-lg " id="savelike"><i class="fas fa-heart"></button></i>
          </form>
          </li>
          @endif
          @endforeach
          @else
          <li class="list-inline-item">
          <form method="POST" action="route('likequote')" class="likequote">
          @csrf
          <input type="hidden" class="form-control col-md-4" name="likequote" id="likequote" value='$quote->id'>
          <button type="submit" class="btn btn-primary shadow-lg " id="savelike"><i class="fas fa-heart"></button></i>
          </form>
          </li>
          @endif
          @endauth





          share|improve this answer



























          • Thanks @Akash The first example works if I remove the @endforeach in the middle. The second does not work. Button does not show.

            – Davinchi1
            Mar 28 at 12:48











          • that's my mistake i updated answer. please mark this as accepted answer

            – Akash Kumar Verma
            Mar 28 at 12:58











          • also updated second solution

            – Akash Kumar Verma
            Mar 28 at 13:19


















          0
















           You can try this 

          @auth
          @isset($quote)
          @if($quote->userLike->count() > 0)
          @foreach($quote->userLike as $like)
          @if($like->pivot->user_id == $id) //passing user id from controller here
          <li class="list-inline-item">
          <form method="POST" action="route('likequote')" class="likequote">
          @csrf
          <input type="hidden" class="form-control col-md-4" name="likequote" id="likequote" value='$quote->id'>
          <button type="submit" class="btn btn-danger shadow-lg " id="savelike"><i class="fas fa-heart"></button></i>
          </form>
          </li>
          @endif
          @endforeach
          @else
          <li class="list-inline-item">
          <form method="POST" action="route('likequote')" class="likequote">
          @csrf
          <input type="hidden" class="form-control col-md-4" name="likequote" id="likequote" value='$quote->id'>
          <button type="submit" class="btn btn-primary shadow-lg " id="savelike"><i class="fas fa-heart"></button></i>
          </form>
          </li>
          @endif
          @endisset
          @endauth





          share|improve this answer

























          • Thanks @manisha. This works, even without the @isset

            – Davinchi1
            Mar 28 at 12:51













          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55390132%2fif-statement-not-presenting-the-else-result%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0
















          • first method

          @auth
          @forelse($quote->userLike as $like)
          @if($like->pivot->user_id == $id) //passing user id from controller here
          <li class="list-inline-item">
          <form method="POST" action="route('likequote')" class="likequote">
          @csrf
          <input type="hidden" class="form-control col-md-4" name="likequote" id="likequote" value='$quote->id'>
          <button type="submit" class="btn btn-danger shadow-lg " id="savelike"><i class="fas fa-heart"></button></i>
          </form>
          </li>
          @endif
          @empty
          <li class="list-inline-item">
          <form method="POST" action="route('likequote')" class="likequote">
          @csrf
          <input type="hidden" class="form-control col-md-4" name="likequote" id="likequote" value='$quote->id'>
          <button type="submit" class="btn btn-primary shadow-lg " id="savelike"><i class="fas fa-heart"></button></i>
          </form>
          </li>
          @endforelse
          @endauth


          • Second

          @auth
          @if(!empty($quote->userLike) && count($quote->userLike)>0)
          @foreach($quote->userLike as $like)
          @if($like->pivot->user_id == $id) //passing user id from controller here
          <li class="list-inline-item">
          <form method="POST" action="route('likequote')" class="likequote">
          @csrf
          <input type="hidden" class="form-control col-md-4" name="likequote" id="likequote" value='$quote->id'>
          <button type="submit" class="btn btn-danger shadow-lg " id="savelike"><i class="fas fa-heart"></button></i>
          </form>
          </li>
          @endif
          @endforeach
          @else
          <li class="list-inline-item">
          <form method="POST" action="route('likequote')" class="likequote">
          @csrf
          <input type="hidden" class="form-control col-md-4" name="likequote" id="likequote" value='$quote->id'>
          <button type="submit" class="btn btn-primary shadow-lg " id="savelike"><i class="fas fa-heart"></button></i>
          </form>
          </li>
          @endif
          @endauth





          share|improve this answer



























          • Thanks @Akash The first example works if I remove the @endforeach in the middle. The second does not work. Button does not show.

            – Davinchi1
            Mar 28 at 12:48











          • that's my mistake i updated answer. please mark this as accepted answer

            – Akash Kumar Verma
            Mar 28 at 12:58











          • also updated second solution

            – Akash Kumar Verma
            Mar 28 at 13:19















          0
















          • first method

          @auth
          @forelse($quote->userLike as $like)
          @if($like->pivot->user_id == $id) //passing user id from controller here
          <li class="list-inline-item">
          <form method="POST" action="route('likequote')" class="likequote">
          @csrf
          <input type="hidden" class="form-control col-md-4" name="likequote" id="likequote" value='$quote->id'>
          <button type="submit" class="btn btn-danger shadow-lg " id="savelike"><i class="fas fa-heart"></button></i>
          </form>
          </li>
          @endif
          @empty
          <li class="list-inline-item">
          <form method="POST" action="route('likequote')" class="likequote">
          @csrf
          <input type="hidden" class="form-control col-md-4" name="likequote" id="likequote" value='$quote->id'>
          <button type="submit" class="btn btn-primary shadow-lg " id="savelike"><i class="fas fa-heart"></button></i>
          </form>
          </li>
          @endforelse
          @endauth


          • Second

          @auth
          @if(!empty($quote->userLike) && count($quote->userLike)>0)
          @foreach($quote->userLike as $like)
          @if($like->pivot->user_id == $id) //passing user id from controller here
          <li class="list-inline-item">
          <form method="POST" action="route('likequote')" class="likequote">
          @csrf
          <input type="hidden" class="form-control col-md-4" name="likequote" id="likequote" value='$quote->id'>
          <button type="submit" class="btn btn-danger shadow-lg " id="savelike"><i class="fas fa-heart"></button></i>
          </form>
          </li>
          @endif
          @endforeach
          @else
          <li class="list-inline-item">
          <form method="POST" action="route('likequote')" class="likequote">
          @csrf
          <input type="hidden" class="form-control col-md-4" name="likequote" id="likequote" value='$quote->id'>
          <button type="submit" class="btn btn-primary shadow-lg " id="savelike"><i class="fas fa-heart"></button></i>
          </form>
          </li>
          @endif
          @endauth





          share|improve this answer



























          • Thanks @Akash The first example works if I remove the @endforeach in the middle. The second does not work. Button does not show.

            – Davinchi1
            Mar 28 at 12:48











          • that's my mistake i updated answer. please mark this as accepted answer

            – Akash Kumar Verma
            Mar 28 at 12:58











          • also updated second solution

            – Akash Kumar Verma
            Mar 28 at 13:19













          0














          0










          0









          • first method

          @auth
          @forelse($quote->userLike as $like)
          @if($like->pivot->user_id == $id) //passing user id from controller here
          <li class="list-inline-item">
          <form method="POST" action="route('likequote')" class="likequote">
          @csrf
          <input type="hidden" class="form-control col-md-4" name="likequote" id="likequote" value='$quote->id'>
          <button type="submit" class="btn btn-danger shadow-lg " id="savelike"><i class="fas fa-heart"></button></i>
          </form>
          </li>
          @endif
          @empty
          <li class="list-inline-item">
          <form method="POST" action="route('likequote')" class="likequote">
          @csrf
          <input type="hidden" class="form-control col-md-4" name="likequote" id="likequote" value='$quote->id'>
          <button type="submit" class="btn btn-primary shadow-lg " id="savelike"><i class="fas fa-heart"></button></i>
          </form>
          </li>
          @endforelse
          @endauth


          • Second

          @auth
          @if(!empty($quote->userLike) && count($quote->userLike)>0)
          @foreach($quote->userLike as $like)
          @if($like->pivot->user_id == $id) //passing user id from controller here
          <li class="list-inline-item">
          <form method="POST" action="route('likequote')" class="likequote">
          @csrf
          <input type="hidden" class="form-control col-md-4" name="likequote" id="likequote" value='$quote->id'>
          <button type="submit" class="btn btn-danger shadow-lg " id="savelike"><i class="fas fa-heart"></button></i>
          </form>
          </li>
          @endif
          @endforeach
          @else
          <li class="list-inline-item">
          <form method="POST" action="route('likequote')" class="likequote">
          @csrf
          <input type="hidden" class="form-control col-md-4" name="likequote" id="likequote" value='$quote->id'>
          <button type="submit" class="btn btn-primary shadow-lg " id="savelike"><i class="fas fa-heart"></button></i>
          </form>
          </li>
          @endif
          @endauth





          share|improve this answer















          • first method

          @auth
          @forelse($quote->userLike as $like)
          @if($like->pivot->user_id == $id) //passing user id from controller here
          <li class="list-inline-item">
          <form method="POST" action="route('likequote')" class="likequote">
          @csrf
          <input type="hidden" class="form-control col-md-4" name="likequote" id="likequote" value='$quote->id'>
          <button type="submit" class="btn btn-danger shadow-lg " id="savelike"><i class="fas fa-heart"></button></i>
          </form>
          </li>
          @endif
          @empty
          <li class="list-inline-item">
          <form method="POST" action="route('likequote')" class="likequote">
          @csrf
          <input type="hidden" class="form-control col-md-4" name="likequote" id="likequote" value='$quote->id'>
          <button type="submit" class="btn btn-primary shadow-lg " id="savelike"><i class="fas fa-heart"></button></i>
          </form>
          </li>
          @endforelse
          @endauth


          • Second

          @auth
          @if(!empty($quote->userLike) && count($quote->userLike)>0)
          @foreach($quote->userLike as $like)
          @if($like->pivot->user_id == $id) //passing user id from controller here
          <li class="list-inline-item">
          <form method="POST" action="route('likequote')" class="likequote">
          @csrf
          <input type="hidden" class="form-control col-md-4" name="likequote" id="likequote" value='$quote->id'>
          <button type="submit" class="btn btn-danger shadow-lg " id="savelike"><i class="fas fa-heart"></button></i>
          </form>
          </li>
          @endif
          @endforeach
          @else
          <li class="list-inline-item">
          <form method="POST" action="route('likequote')" class="likequote">
          @csrf
          <input type="hidden" class="form-control col-md-4" name="likequote" id="likequote" value='$quote->id'>
          <button type="submit" class="btn btn-primary shadow-lg " id="savelike"><i class="fas fa-heart"></button></i>
          </form>
          </li>
          @endif
          @endauth






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 28 at 13:19

























          answered Mar 28 at 4:27









          Akash Kumar VermaAkash Kumar Verma

          1,2842 gold badges5 silver badges17 bronze badges




          1,2842 gold badges5 silver badges17 bronze badges















          • Thanks @Akash The first example works if I remove the @endforeach in the middle. The second does not work. Button does not show.

            – Davinchi1
            Mar 28 at 12:48











          • that's my mistake i updated answer. please mark this as accepted answer

            – Akash Kumar Verma
            Mar 28 at 12:58











          • also updated second solution

            – Akash Kumar Verma
            Mar 28 at 13:19

















          • Thanks @Akash The first example works if I remove the @endforeach in the middle. The second does not work. Button does not show.

            – Davinchi1
            Mar 28 at 12:48











          • that's my mistake i updated answer. please mark this as accepted answer

            – Akash Kumar Verma
            Mar 28 at 12:58











          • also updated second solution

            – Akash Kumar Verma
            Mar 28 at 13:19
















          Thanks @Akash The first example works if I remove the @endforeach in the middle. The second does not work. Button does not show.

          – Davinchi1
          Mar 28 at 12:48





          Thanks @Akash The first example works if I remove the @endforeach in the middle. The second does not work. Button does not show.

          – Davinchi1
          Mar 28 at 12:48













          that's my mistake i updated answer. please mark this as accepted answer

          – Akash Kumar Verma
          Mar 28 at 12:58





          that's my mistake i updated answer. please mark this as accepted answer

          – Akash Kumar Verma
          Mar 28 at 12:58













          also updated second solution

          – Akash Kumar Verma
          Mar 28 at 13:19





          also updated second solution

          – Akash Kumar Verma
          Mar 28 at 13:19













          0
















           You can try this 

          @auth
          @isset($quote)
          @if($quote->userLike->count() > 0)
          @foreach($quote->userLike as $like)
          @if($like->pivot->user_id == $id) //passing user id from controller here
          <li class="list-inline-item">
          <form method="POST" action="route('likequote')" class="likequote">
          @csrf
          <input type="hidden" class="form-control col-md-4" name="likequote" id="likequote" value='$quote->id'>
          <button type="submit" class="btn btn-danger shadow-lg " id="savelike"><i class="fas fa-heart"></button></i>
          </form>
          </li>
          @endif
          @endforeach
          @else
          <li class="list-inline-item">
          <form method="POST" action="route('likequote')" class="likequote">
          @csrf
          <input type="hidden" class="form-control col-md-4" name="likequote" id="likequote" value='$quote->id'>
          <button type="submit" class="btn btn-primary shadow-lg " id="savelike"><i class="fas fa-heart"></button></i>
          </form>
          </li>
          @endif
          @endisset
          @endauth





          share|improve this answer

























          • Thanks @manisha. This works, even without the @isset

            – Davinchi1
            Mar 28 at 12:51















          0
















           You can try this 

          @auth
          @isset($quote)
          @if($quote->userLike->count() > 0)
          @foreach($quote->userLike as $like)
          @if($like->pivot->user_id == $id) //passing user id from controller here
          <li class="list-inline-item">
          <form method="POST" action="route('likequote')" class="likequote">
          @csrf
          <input type="hidden" class="form-control col-md-4" name="likequote" id="likequote" value='$quote->id'>
          <button type="submit" class="btn btn-danger shadow-lg " id="savelike"><i class="fas fa-heart"></button></i>
          </form>
          </li>
          @endif
          @endforeach
          @else
          <li class="list-inline-item">
          <form method="POST" action="route('likequote')" class="likequote">
          @csrf
          <input type="hidden" class="form-control col-md-4" name="likequote" id="likequote" value='$quote->id'>
          <button type="submit" class="btn btn-primary shadow-lg " id="savelike"><i class="fas fa-heart"></button></i>
          </form>
          </li>
          @endif
          @endisset
          @endauth





          share|improve this answer

























          • Thanks @manisha. This works, even without the @isset

            – Davinchi1
            Mar 28 at 12:51













          0














          0










          0









           You can try this 

          @auth
          @isset($quote)
          @if($quote->userLike->count() > 0)
          @foreach($quote->userLike as $like)
          @if($like->pivot->user_id == $id) //passing user id from controller here
          <li class="list-inline-item">
          <form method="POST" action="route('likequote')" class="likequote">
          @csrf
          <input type="hidden" class="form-control col-md-4" name="likequote" id="likequote" value='$quote->id'>
          <button type="submit" class="btn btn-danger shadow-lg " id="savelike"><i class="fas fa-heart"></button></i>
          </form>
          </li>
          @endif
          @endforeach
          @else
          <li class="list-inline-item">
          <form method="POST" action="route('likequote')" class="likequote">
          @csrf
          <input type="hidden" class="form-control col-md-4" name="likequote" id="likequote" value='$quote->id'>
          <button type="submit" class="btn btn-primary shadow-lg " id="savelike"><i class="fas fa-heart"></button></i>
          </form>
          </li>
          @endif
          @endisset
          @endauth





          share|improve this answer













           You can try this 

          @auth
          @isset($quote)
          @if($quote->userLike->count() > 0)
          @foreach($quote->userLike as $like)
          @if($like->pivot->user_id == $id) //passing user id from controller here
          <li class="list-inline-item">
          <form method="POST" action="route('likequote')" class="likequote">
          @csrf
          <input type="hidden" class="form-control col-md-4" name="likequote" id="likequote" value='$quote->id'>
          <button type="submit" class="btn btn-danger shadow-lg " id="savelike"><i class="fas fa-heart"></button></i>
          </form>
          </li>
          @endif
          @endforeach
          @else
          <li class="list-inline-item">
          <form method="POST" action="route('likequote')" class="likequote">
          @csrf
          <input type="hidden" class="form-control col-md-4" name="likequote" id="likequote" value='$quote->id'>
          <button type="submit" class="btn btn-primary shadow-lg " id="savelike"><i class="fas fa-heart"></button></i>
          </form>
          </li>
          @endif
          @endisset
          @endauth






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 28 at 12:27









          ManishaManisha

          748 bronze badges




          748 bronze badges















          • Thanks @manisha. This works, even without the @isset

            – Davinchi1
            Mar 28 at 12:51

















          • Thanks @manisha. This works, even without the @isset

            – Davinchi1
            Mar 28 at 12:51
















          Thanks @manisha. This works, even without the @isset

          – Davinchi1
          Mar 28 at 12:51





          Thanks @manisha. This works, even without the @isset

          – Davinchi1
          Mar 28 at 12:51

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55390132%2fif-statement-not-presenting-the-else-result%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

          은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현