title: Call custom mysql function from laravel helper
body: <p>I created a helper to run a custom function in mysql, I'm trying to match<br>
     parameters found in the DB, so it should return X if it's succesful. </p>
  
  <p>Blade :</p>
  
  <pre><code> @foreach($ficha as $est)
           @foreach($est-&gt;equipos as $eq)
              @foreach($eq-&gt;parametros as $param)
  
               &lt;p&gt;{{ tiene_parametro_ficha($param-&gt;nombre ,$ficha-&gt;first()-&gt;id) }}&lt;/p&gt;   //FUNCTION, pass 2 values
  
                 @endforeach      
              @endforeach
           @endforeach  
  </code></pre>
  
  <p>Helper:</p>
  
  <pre><code> function tiene_parametro_ficha($param, $id_est)
    {
     $queries =DB::select("tiene_parametro_ficha($param, $id_est)");  //I tried alias Result , it gives error too
   } 
  </code></pre>
  
  <p>Mysql Function :</p>
  
  <pre><code>  BEGIN
    DECLARE mivar INT;
    SET @PAR=PARAM;
    SET @ID_EST = ID_EST;
  
  
   SELECT  (if((p.nombre = @PAR),1,0)) INTO mivar
   FROM estacion AS e
          INNER JOIN equipo_estacion AS ee ON ee.estacion_id = @ID_EST
          INNER JOIN equipo AS eq ON eq.id = ee.equipo_id
          INNER JOIN equipo_parametro AS e_p ON e_p.equipo_id = eq.id
          INNER JOIN parametro AS p ON p.id = e_p.parametro_id
        WHERE p.nombre = @PAR AND ee.estado ="activo" AND
        eq.deleted_at IS NULL LIMIT 1;
  
      CASE mivar
      WHEN 1 THEN
      RETURN 'X';
      WHEN 0 THEN
      RETURN '0'; 
      ELSE
      RETURN '';
     END CASE;
     END
  </code></pre>
  
  <p>Error i get
    <a href="https://i.stack.imgur.com/Q2XNS.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Q2XNS.jpg" alt="enter image description here"></a></p>