How to check additional field during login in Laravel?
up vote
0
down vote
favorite
How to check additional field during login in Laravel?
Now it works from the box and accepts email and password. How to check additionally status parameter when user log in?
I use this LoginController
:
use AppHttpControllersController;
use IlluminateFoundationAuthAuthenticatesUsers;
class LoginController extends Controller
{
use AuthenticatesUsers;
}
I tried this in LoginController:
public function authenticate(Request $request)
{
$credentials = $request->only('email', 'password');
$credentials['status'] = 1;
if (Auth::attempt($credentials)) {
return redirect()->intended('home');
}
}
But Laravel ignores this method authenticate().
if to remove use AuthenticatesUsers;
it becomes alive, but then does not work logout, login page.
laravel laravel-5 laravel-5.2
add a comment |
up vote
0
down vote
favorite
How to check additional field during login in Laravel?
Now it works from the box and accepts email and password. How to check additionally status parameter when user log in?
I use this LoginController
:
use AppHttpControllersController;
use IlluminateFoundationAuthAuthenticatesUsers;
class LoginController extends Controller
{
use AuthenticatesUsers;
}
I tried this in LoginController:
public function authenticate(Request $request)
{
$credentials = $request->only('email', 'password');
$credentials['status'] = 1;
if (Auth::attempt($credentials)) {
return redirect()->intended('home');
}
}
But Laravel ignores this method authenticate().
if to remove use AuthenticatesUsers;
it becomes alive, but then does not work logout, login page.
laravel laravel-5 laravel-5.2
are you want to attach another parameter when user wants to login ? like email , password and user type ?
– Emtiaz Zahid
Nov 8 at 2:54
please check the right answer as your solution as stackoverflow policy. thanks
– Emtiaz Zahid
Nov 9 at 12:18
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
How to check additional field during login in Laravel?
Now it works from the box and accepts email and password. How to check additionally status parameter when user log in?
I use this LoginController
:
use AppHttpControllersController;
use IlluminateFoundationAuthAuthenticatesUsers;
class LoginController extends Controller
{
use AuthenticatesUsers;
}
I tried this in LoginController:
public function authenticate(Request $request)
{
$credentials = $request->only('email', 'password');
$credentials['status'] = 1;
if (Auth::attempt($credentials)) {
return redirect()->intended('home');
}
}
But Laravel ignores this method authenticate().
if to remove use AuthenticatesUsers;
it becomes alive, but then does not work logout, login page.
laravel laravel-5 laravel-5.2
How to check additional field during login in Laravel?
Now it works from the box and accepts email and password. How to check additionally status parameter when user log in?
I use this LoginController
:
use AppHttpControllersController;
use IlluminateFoundationAuthAuthenticatesUsers;
class LoginController extends Controller
{
use AuthenticatesUsers;
}
I tried this in LoginController:
public function authenticate(Request $request)
{
$credentials = $request->only('email', 'password');
$credentials['status'] = 1;
if (Auth::attempt($credentials)) {
return redirect()->intended('home');
}
}
But Laravel ignores this method authenticate().
if to remove use AuthenticatesUsers;
it becomes alive, but then does not work logout, login page.
laravel laravel-5 laravel-5.2
laravel laravel-5 laravel-5.2
asked Nov 8 at 2:12
OPV
1,33621228
1,33621228
are you want to attach another parameter when user wants to login ? like email , password and user type ?
– Emtiaz Zahid
Nov 8 at 2:54
please check the right answer as your solution as stackoverflow policy. thanks
– Emtiaz Zahid
Nov 9 at 12:18
add a comment |
are you want to attach another parameter when user wants to login ? like email , password and user type ?
– Emtiaz Zahid
Nov 8 at 2:54
please check the right answer as your solution as stackoverflow policy. thanks
– Emtiaz Zahid
Nov 9 at 12:18
are you want to attach another parameter when user wants to login ? like email , password and user type ?
– Emtiaz Zahid
Nov 8 at 2:54
are you want to attach another parameter when user wants to login ? like email , password and user type ?
– Emtiaz Zahid
Nov 8 at 2:54
please check the right answer as your solution as stackoverflow policy. thanks
– Emtiaz Zahid
Nov 9 at 12:18
please check the right answer as your solution as stackoverflow policy. thanks
– Emtiaz Zahid
Nov 9 at 12:18
add a comment |
2 Answers
2
active
oldest
votes
up vote
1
down vote
accepted
You can add another field to check login by credentials
function
inside you LoginController
add credentials
function and append extra field with email, password
Example:
public function credentials(Request $request)
{
$credentials = $request->only($this->email(), 'password');
$credentials = array_add($credentials, 'status', '1');
return $credentials;
}
add a comment |
up vote
1
down vote
Your question tag is laravel 5.2, then for 5.2 you should override getCredentials function:
protected function getCredentials(Request $request)
{
$credentials = $request->only($this->loginUsername(), 'password');
$credentials['status'] = 1;
return $credentials;
}
if you using laravel 5.3+ the answer of Emtiaz Zahid is correct (override credentials function)
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
You can add another field to check login by credentials
function
inside you LoginController
add credentials
function and append extra field with email, password
Example:
public function credentials(Request $request)
{
$credentials = $request->only($this->email(), 'password');
$credentials = array_add($credentials, 'status', '1');
return $credentials;
}
add a comment |
up vote
1
down vote
accepted
You can add another field to check login by credentials
function
inside you LoginController
add credentials
function and append extra field with email, password
Example:
public function credentials(Request $request)
{
$credentials = $request->only($this->email(), 'password');
$credentials = array_add($credentials, 'status', '1');
return $credentials;
}
add a comment |
up vote
1
down vote
accepted
up vote
1
down vote
accepted
You can add another field to check login by credentials
function
inside you LoginController
add credentials
function and append extra field with email, password
Example:
public function credentials(Request $request)
{
$credentials = $request->only($this->email(), 'password');
$credentials = array_add($credentials, 'status', '1');
return $credentials;
}
You can add another field to check login by credentials
function
inside you LoginController
add credentials
function and append extra field with email, password
Example:
public function credentials(Request $request)
{
$credentials = $request->only($this->email(), 'password');
$credentials = array_add($credentials, 'status', '1');
return $credentials;
}
answered Nov 8 at 2:59
Emtiaz Zahid
1,015516
1,015516
add a comment |
add a comment |
up vote
1
down vote
Your question tag is laravel 5.2, then for 5.2 you should override getCredentials function:
protected function getCredentials(Request $request)
{
$credentials = $request->only($this->loginUsername(), 'password');
$credentials['status'] = 1;
return $credentials;
}
if you using laravel 5.3+ the answer of Emtiaz Zahid is correct (override credentials function)
add a comment |
up vote
1
down vote
Your question tag is laravel 5.2, then for 5.2 you should override getCredentials function:
protected function getCredentials(Request $request)
{
$credentials = $request->only($this->loginUsername(), 'password');
$credentials['status'] = 1;
return $credentials;
}
if you using laravel 5.3+ the answer of Emtiaz Zahid is correct (override credentials function)
add a comment |
up vote
1
down vote
up vote
1
down vote
Your question tag is laravel 5.2, then for 5.2 you should override getCredentials function:
protected function getCredentials(Request $request)
{
$credentials = $request->only($this->loginUsername(), 'password');
$credentials['status'] = 1;
return $credentials;
}
if you using laravel 5.3+ the answer of Emtiaz Zahid is correct (override credentials function)
Your question tag is laravel 5.2, then for 5.2 you should override getCredentials function:
protected function getCredentials(Request $request)
{
$credentials = $request->only($this->loginUsername(), 'password');
$credentials['status'] = 1;
return $credentials;
}
if you using laravel 5.3+ the answer of Emtiaz Zahid is correct (override credentials function)
answered Nov 8 at 3:31
Erick Patrick
30124
30124
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53200586%2fhow-to-check-additional-field-during-login-in-laravel%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
are you want to attach another parameter when user wants to login ? like email , password and user type ?
– Emtiaz Zahid
Nov 8 at 2:54
please check the right answer as your solution as stackoverflow policy. thanks
– Emtiaz Zahid
Nov 9 at 12:18