Mam takie pytanie. Mam sobie użytkownika, który się loguje i tam jest opcja zapamiętaj mnie i co trzeba w kodzie zrobić, żeby jak się zaznaczy ta opcje to, żeby była w kodzie uwzględniona.
Bo mam dwóch użytkowników w jednym jest zwykły user i w tym przypadku mam controller wewnętrzny natomiast do logowania lekarza mam controller swój tylko, że w tym controllerze nie uwzględnia zapamiętaj mnie.
<div id="login">
<form action="{{ route('userDr.loginSubmit')}}" method="post">
<table class="table login">
<tr>
<td colspan="2">
<span class="hight">LOGOWANIE LEKARZA</span>
</td>
</tr>
<tr>
<td width="40%">
login
</td>
<td>
<input type="text" name="email" class="form-control" value="{{Request::old("loginDr")}}">
</td>
</tr>
<tr>
<td width="40%">
hash
</td>
<td>
<input type="password" name="password" class="form-control">
</td>
</tr>
<tr>
<td>
<label class="form-check-label" for="remember">
{{ __('Zapamiętaj mnie') }}
</label>
</td>
<td align='left'>
<input class="form-check-input" type="checkbox" name="remember" id="remember" {{ old('remember') ? 'checked' : '' }}>
</td>
</tr>
<tr>
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<tr>
<td colspan="2">
<input type="submit" value="Zaloguj" class="btn btn-primary">
</td>
</tr>
</table>
</form>
<div id="error">
@if (!empty(session('errors2')))
@foreach ($errors2->all() as $error)
{{$error}}<br>
@endforeach
@endif
</div>
</div>
public function loginDr(Request $request) {
$User = array(
"login2" => $request->get("email"),
"password" => $request->get("password"),
"if_true" => 1
);
if ( $request->get('password') == "" ) {
return Redirect('/User/Login')->with('error','Uzupełnij pole login i hasło');
}
if (Auth::attempt($User) ) {
return Redirect("/Main");
}
else {
return Redirect('/User/Login')->with('error','Nie prawidłowy login lub hasło');
}
}