Insert if inside laravel driver

0

I would like to introduce a simple if () to see when the variable $row->photo is empty simply this

    if($row->photo){
/// contenido <img> }

But I can not implement it without having syntax error someone gives me a hand?

Controller

    function fetchdes(Request $request)
        {
         if($request->get('query'))
         {
          $query = $request->get('query');
          $data = DB::table('testing')
            ->where('nombre', 'LIKE', "%{$query}%")
            ->get();
          $output = '<ul class="dropdown-menu" style="display:block; position:absolute">';
          foreach($data as $row)
          {
           $output .= '
           <a href="#">
           <li class="formquery">
           <input type="hidden" name="test" value="'.$row->test.'">
           <table>
           <tr>
            <td>

    Aquí necesito el if

     <img src="'.asset('storage/images/mini').'/'.$row->id.'/'.$row->photo.'"/>

   Y aquí acabaría

       </td><td>
       <h4>'.$row->nombre.'</h4>
       </td>
       </tr>
       </table>
       </li></a>
       '
       ;
      }
      $output .= '</ul>';
      echo $output;
     }
    }
    
asked by jorge 08.11.2018 в 21:19
source

0 answers