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

jericopulvera's avatar

Laravel to php

how do I convert this $food_list->recipe to php?

 $sickness = Highblood;
 $list = FoodList::where('illness', $sickness)->get();

How to do this? in my sql.
  @foreach($list as $food_list)
    <p> <h4> {{ $food_list->name }} </h4> </p>
    <strong> <h5> Ingridients </h5> </strong>
           {{ $food_list->recipe }} //convert this to sql query

    <strong> <h5> Directions </h5> </strong>
       {{ $food_list->directions }} //convert this to sql query
    @endforeach 

My table structure

  • id
  • name
  • illness
  • recipe
  • directions
0 likes
1 reply
zachleigh's avatar

This is the only sql query in your code:

FoodList::where('illness', $sickness)->get();

Please or to participate in this conversation.