0
I need a if to check 2 values of the register and 2 of the bank, if both are equal should not occur the register.
<div class="container-fluid">
<form action="adiciona" method="post" >
<div class="form-group has-success has-feedback">
<input type="hidden"
name="_token" value="{{{ csrf_token() }}}" />
<label>Solicitação:</label>
<select name="Cadastro_idCadastro" lass="js-data-example-ajax">
@foreach($cadastro as $c)
<option value="{{$c->idCadastro}}">{{$c->idCadastro}}</option>
@endforeach
</select><br></br>
<label>Usúario:</label>
<select name="users_id" lass="js-data-example-ajax">
@foreach($user as $c)
<option value="{{$c->id}}">{{$c->name}}</option>
@endforeach
</select><br></br>
<label>Aprovador:</label>
<select name="Aprovado_idaprovado" lass="js-data-example-ajax">
@foreach($aprovar as $c)
<option value="{{$c->idaprovado}}">{{$c->descaprovado}}</option>
@endforeach
</select><br></br>
<button type="submit" class="btn
btn-primary btn-block">Adicionar Aprovador</button>
</form>
public function adiciona()
{
Aprovadores::create(Request::all());
return redirect()->action('AprovadoresController@novo');
}
What’s the mistake? Only the code is vacant.
– novic
sorry, I need a se to check 2 values of the register and 2 of the bank, if both are equal should not occur the registration. my controller Approvers::create(Request::all(); Return redirect() ->action('Approvedscontroller@new');
– Vagner
following which values cannot be repeated if you can put the table in your question?
– novic
idCadastro and id of the user.
– Vagner
pass me the table
Aprovadores
(you shouldn’t do that kind of Insert either?– novic
idAp, Cadas_ipcadatro, users_id, Approved
– Vagner
(shouldn’t one do that kind of Insert too? ) I don’t understand
– Vagner
was testing do Insert with create(Resquest)
– Vagner
(shouldn’t one do that kind of Insert too? ) always specify the fields that are inserted never let the responsibility remain for the table this can cause future problems! , without delay put your table so that I understand what you want to do! ta half vague.
– novic
don’t know how to use stack over right, you have skype?
– Vagner
then it’s time to learn friend, put in your question the layout of the table and explain your doubt better I can help you around here.
– novic
Okay, I need to use validation to not let you save two equal compos to not duplicate, I need to take 2 fields in the database and compare them with two form fields, https://laravel.com/docs/5.5/validation I’m TRYING TO FIND, BUT NOTHING ELSE
– Vagner
I guess you don’t need to put table.
– Vagner
it was good to put the table
– novic
see if you get it.
– Vagner
users_id registration, both can only have once in the database
– Vagner
version of the Standard?
– novic
Laravel 5.5 ta in the title rsrs
– Vagner
put on the tag will learn.
– novic
What tag ? Oh you squeezed me.
– Vagner