Tuesday, March 7, 2017

How to make a custom auth query in Laravel

I'm new in using Laravel and I have some problems. when I create an auth using the following command:

php artisan make:auth

It automatically creates Auth controller, views, and default user table. Here, I want to make some different auth. I have a table like this:

employees

id | reg_number | name

users

id | name | password | remember_token | employee_id | created_at | updated_at

When I log in, I want to join employees and users table, so the query will be like:

select users.*, employees.reg_number inner join employees on employees.id = users.employee_id

Then, I want to log in using reg_number and password.

How can I create something like that?

I've been searching on many sites, but have not found any solution. Thanks in advance for your answers.



via yulianto saparudin

Advertisement