Laravel Eloquent

Asked

Viewed 39 times

0

I’m trying to do this query but the $test variable enters empty in the query but when I print it, I see it exists

namespace App\Http\Controllers;

use Illuminate\Http\Request;
Use App\User;

class BinarioController extends Controller
{
public function listanaoposicionados()
{
    $checar_patrocinador_posicionado_sql = User::where('indicacao', auth()->user()->name)->get();
    //dd($checar_patrocinador_posicionado_sql);

    foreach($checar_patrocinador_posicionado_sql as $patrocinado){

        $teste = $patrocinado->name;

        echo $teste;

        $verifica_existe_rede_binairo = User::where('referido_1','=',$teste )->orWhere('referido_2','=', $teste)->toSql();
        dd($verifica_existe_rede_binairo);

       //if($verifica_existe_rede_binairo->isEmpty()){ 
       //}

    }
     //return view('mmn.derramamento')->with('patrocinados',$patrocinados);
}

}

  • $checar_patrocinador_posicionado_sql here comes something?

  • Opa Virgilio, arrives yes, so q I printed the variable $test but qnd I debug ( dd($verifica_existe_rede_binairo)) $test comes empty

  • Beverly Hills "select * from users Where referido_1 = ? or referido_2 = ?"

  • ->toSql(); It’s like this and put get()? returns something

  • not = returned nothing, then I used toSql(); to see what was entering, and saw that nothing entered

  • Collection {#231 #items: [] }

  • Matheus must not be satisfying the search the contents of the variable $test!?

  • rsrsrs the funny, q I printo her, and she appears, it’s old Capiroto’s thing

  • next face User::where('referido_1','=',$teste ) the value of referido_1 is equal to the value of $test?

  • ahammmm yes!!!!

  • complicated without even seeing it! seems a local problem

  • What is the version of Laravel and php? try to declare $test = null; before foreach and do so User::Where('referendo_1, $test) plus a toSql thing won’t show the value of $test even if it doesn’t.

  • Really? I swore I would show, when toSql’s "?" appears and tosql’s qnd appears the damned

Show 8 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.