Create temporary accesses in laravel 5.4

1

I am developing an application where a tutor can create temporary credentials so that the students assigned to them can enter to perform a test, the test table has the following attributes:

id, nick,password, status, student_id

I have read that there is some simple way to make it an authenticable model but everything is focused on the user table and I do not want to touch that part.

Any suggestions?

    
asked by DVertel 29.03.2017 в 05:59
source

2 answers

0

Use softkeys and you can un-enable accounts when this field has a timestamp other than NULL.

link

    
answered by 29.03.2017 в 14:35
0

Auth Block User.

Add a new field to your users table called 'status' of boolean type.

Then in app / Http / Controllers / Auth / LoginController.php write a new method of the type:

protected function credentials(\Illuminate\Http\Request $request)
{
  $credentials = $request->only($this->username(), 'password');
  return array_add($credentials, 'status', '1');
}

Finally in the model do not forget to add - > where ('status', 1) where you recover your users.

    
answered by 24.08.2018 в 18:04