jeudi 1 juillet 2021

Property [costo] does not exist on this collection instance

i need to print the price of a service, but can't find the column with the price. maybe I'm doing something wrong with relationships, but I can't figure it out on my own

database: enter image description here

Controller:

  public function details(Request $request,$id){

    $datax = [
      'category_name' => 'apps',
      'page_name' => 'calendar',
      'has_scrollspy' => 0,
      'scrollspy_offset' => '',

  ];



  
    $evento = Eventos::find($id);
    $servicio = \App\Models\Eventos::select("servicio_id")->where('servicio_id', $evento->id)->get('servicio_id');
    $event = Eventos::find($id);
    $event->asistencia = $request->asistencia;
    $event->cancelado = $request->cancelado;
    $event->save();

    return view("evento",[
      "event" => $event,
      "servicio" => $servicio
    ])->with($datax);

  }

blade.php

  <div class="input-group mb-4">
  <div class="input-group-prepend">
    <span class="input-group-text">$</span>
  </div>
  <input type="text" value="" 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>

I need to print the "costo" column in relation to service_id

help please



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire