I have a method:
protected function validateLogin(Request $request)
{
$this->validate($request, [
'email' => 'required|string|exists:users,email,active,1,online,0',
'password' => 'required|string',
], [
'password.required' => 'Password required!',
'email.exists' => 'Email not found!',
]);
}
Which validates that in the database within the 'users' table there is a user with a certain email address, that the user is active and not logged in. The schema of the 'users' table is the following:
Schema::create($this->table, function (Blueprint $table) {
$table->increments('id');
$table->string('first_name');
$table->string('last_name');
$table->string('email')->unique();
$table->string('password');
$table->boolean('active')->default(true);
$table->boolean('online')->default(false);
$table->timestamps();
});
I want to return an error message depending on the user's status (online | active)
Could you tell me how I could do? I have tried with:
protected function validateLogin(Request $request)
{
$this->validate($request, [
'email' => 'required|string|exists:users,email,active,1,online,0',
'password' => 'required|string',
], [
'password.required' => 'Password required!',
'email.exists' => 'Email not found!',
'email.active' => 'User not active!',
'email.online' => 'Email is onlone!',
]);
}