mardi 6 juillet 2021

Checking If a Exists Record

how can check if there is a record? i need to make a condition, which hides a layer if there is a record.

IF the event id exists in the charges table: hide

@if ($cobros->turnos == $event->id)

<h5>Paid Service</h5>

@else
    <div class="input-group mb-4">
  <div class="input-group-prepend">
    <span class="input-group-text">$</span>
  </div>
  <input type="hidden" value="" name="servicio_id">
  <input type="hidden" value="" name="turno_id">
  <input type="text" value="" name="importe" class="form-control col-md-3" aria-label="Amount (to the nearest dollar)">
  <div class="input-group-append">
    <span class="input-group-text"></span>
  </div>
</div>


    </div>
  </div>
  
  </div>

@endif

Models: https://i.imgur.com/0TQNwSU.png

Controller:

    $cobros = Cobros::where('turno_id',  $request->id)->first();


from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/36l5vlo
via IFTTT

Aucun commentaire:

Enregistrer un commentaire