Request Variable returning null

Asked

Viewed 296 times

1

Good afternoon guys, I’m new to frameworks but I have the following little problem:

the request ta returning empty for my query

thanks in advance

"select * from `usuarios` where `cep` = ?"

my controller is like this

    public function procurapatrocinadorexecutar(Request $request){

   //dd($request);
   $dados = usuarios::where('cep', $request->cep)->toSql();
    dd($dados);

and my view like this ( already has csrf_field)

@extends('template.login')

@section('login')

<form class="form-signin" action="/PesquisarPatrocinador" method="post">
{{ csrf_field() }}
<div class="panel periodic-login">
<div class="panel-body text-center">
  <h1 class="atomic-symbol">MMN</h1>
  <p class="atomic-mass">14.072110</p>
  <p class="element-name">Miminium</p>
  @include('includes.erros')
  <i class="icons icon-arrow-down"></i>
  <div class="form-group form-animate-text" style="margin-top:40px !important;">
    <input type="text" class="form-text" name="cep" required value="1305135">
    <span class="bar"></span>
    <label>Informe seu cep para pesquisa</label>
  </div>
  <input type="submit" class="btn col-md-12" value="Pesquisar"/>
</div>
@if(isset($dados))
@forelse ($dados as $dados)
<li>{{ $dados->usuario }}</li>
@empty
   aaa
@endforelse
@endif

<div class="text-center" style="padding:5px;">
  <a href="/">Voltar</a>
</div>
<div class="text-center" style="padding:5px;">
  <a href="/RecuperarSenha">Esqueceu a Senha? </a>
  <a href="/registrar_com/procurar">|Seja um Afilido, Procure um Patrocinador</a>
</div>
</div>
</form>
 @endsection
  • Your select does not indicate a variable ? I do not understand, and your Function does not close keys?

  • is q i put only the chunk of the function, thus the cep input is not coming in my request

  • Is your action correct? You don’t have the file extension just the name, example action="save.php"

  • Route::post('/Searchatrocinador','Controllerlogin@procurasponsor execute'); this is my route

  • Because toSql?..

  • just to see the return of sql

  • Okay @Matheusgonzales then gives a var_dump($request->cep); and check what returns and then if you see correctly the cep make a var_dump(usuarios::where('cep', $request->cep)->get()); and check what returns ... has nowhere to escape! and also check whether returned the value ... that toSql() only actually shows SQL or ? is in the way bindings the problem then is in the arrival of the information or not arrival in the information...

Show 2 more comments
No answers

Browser other questions tagged

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