Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

129
Views
La propiedad del objeto con el valor nulo se trata como ''

Tengo un conjunto de código donde recupero datos de la base de datos usando elocuente

Controlador

 $display_tickets = ManualTicket::select('*') ->with('user') ->with('initiator') ->with('manual_ticket_log') ->where(function ($checkClients) use($target_client_id){ $checkClients->whereHas('user', function ($checkClient) use($target_client_id){ $checkClient->where('client_id', '=', $target_client_id); }) ->orWhereHas('initiator', function ($checkClient2) use($target_client_id){ $checkClient2->where('client_id', '=', $target_client_id); }); }) ->whereBetween('manual_tickets.created_at', [$start_date->toDateString(), $end_date->addDays(1)->toDateString()]) ->orderBy("manual_tickets.created_at", "desc")->get();

Luego, la variable se devuelve al archivo blade.

 return view('ticket-dashboard/dashboard', compact('display_tickets'));

En el archivo blade, por cada ticket que recibo, los muestro en una tabla. Sin embargo, cuando la propiedad $display_tickets['ticket_flow_id'] es nula, se considera como ' ' en el archivo blade cuando en realidad tiene el valor nulo. ¿¿¿Porqué es eso???

 @foreach($display_tickets as $p) <table> <th> ticket flow id </th> <tr> <td> <script type="application/javascript"> console.log('{{$p['ticket_flow_id']}}'); var typee = '{{$p['ticket_flow_id']}}'; console.log(typeof typee); </script> </td>

ingrese la descripción de la imagen aquí

Código del controlador

 error_log(json_encode($display_tickets)); error_log("??salkag"); error_log(json_encode($display_tickets->ticket_flow_id)); error_log(gettype($display_tickets->ticket_flow_id));

ingrese la descripción de la imagen aquí

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Posibilidad remota, pero ¿has probado esto?

 {!! $p['ticket_flow_id'] !!}

De forma predeterminada, {{}} pasa la cadena a través de PHPs htmlspecialchars , es posible que obtenga el resultado esperado, aunque lo abre a XSS

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!