I have 2 separate controls for my website.
Operators
Users
I want to authenticate users from 2 different tables for my application. Like if user if on myapplication.com/admin it should be authenticated from tbl_operators and if the user if on myapplication.com it should be authenticated from tbl_users
How to achieve this functionality in Laravel 5.2
If you plan to use the Auth built in with Laravel then this may not be possible. However if you wanna build your own authentication specifically for the admin then this may be possible.
You could also look into storing in an entirely new database using
DB::connection('name')
Related
I want to create a new Laravel 5.8 based application using the database of an old PHP based application.
The problem is: My previous project uses five tables to store user-related information and all of those tables are used during login (to set session data).
Those tables are user_account, user_role, user_partner_portal, user_access_control, and user_control_access_right.
The relationship between those tables are in the below images:
By default, laravel uses users table to handle authentication and I don't know how to customize Laravel login system so that I can use all of those five tables during login to authenticate a user and also store the user-related information into the session.
I am primarily using CodeIgniter for all of my projects and it is very easy to do that authentication using CodeIgniter. But I am new in Laravel, so I can't figure it out.
So my question is: Is it possible using laravel to design such an authentication system? If yes then how?
TIA
So laravel uses LoginController class for the login. Inside there you are going to find the function authenticate.
Laravel put's the predefined logic there but if you want to make it really custom like update all your tables etc etc you are free to do it.
You can even create your own class and change the login route to point to your own controller. Basically you can do anything you like.
Note: There is no code to show or prove it, we just need a methodology to solve the problem before implementing the code to our code base.
We have more than one user for our fashion web (laravel app)
Guest (does not matter to this issue)
User (Fashion lovers/Customers/Clients)
Tailors (Fashion designers new/existing accounts in the platform)
The users(customers) can login and register to their application without no problem but our problem is how can we filter the two users(customers/tailors) such that when a user (tailor) logins to www.app.dev/tailor#dashboard (without access) it redirects to (www.app.dev/login) and when the user is a tailor it takes the user to tailors login page instead the user (customers) login, Do you understand me??
check for following stackoverflow questions
Can anyone explain Laravel 5.2 Multi Auth with example
How to use multi Auth in laravel 5.2
Multiple auth user types in Laravel 5
I am new to Laravel, and currently I am developing a job website project using Laravel 5. In the website, in addition to the Admin user, I have three types of users- jobseeker, employer, and training provider, which I want to seperate the three tables because each of them store different information. Plus, each of them should go to certain allowed user logged in area. For example, logged job seeker can only work on their allowed area, and employer and training provider can do the same thing.
Could you advise me how to manage authentication for each tables?
Best Regards,
Naren
The best way to manage this in Laravel is use a plugin. Try this: Laravel ACL
It uses following table to manage role based access for entire application:
users
role_user
roles
permissions
permission_role
permission_user
By using this module you can manage role wise as well as individual person permission also.
You can apply the following stuffs from Laravel 5.2+,
Use multi authentication. So each type of user has its own model: JobSeeker, Employer, TrainingProvider. They will have their own Guard in middleware for authentication.
Routes are protected via middleware. Some routes are permitted to all, some are personal...
Since each role might have same or different access to some type of actions, ex. all have access the JobSeeker profile (to view), but only JobSeeker can edit the profile. Use the Laravel Policy.
I'm building a site that has two areas: the main site, and an admin area.
The main site has to have Facebook login functionality (I'm looking at using Sammy K's Laravel Facebook SDK) and the admin area is just going to have a database-based login; basically the Laravel login system.
I'm wondering how to approach this, and whether anyone's done this before. Some design considerations:
Should I have two separate user tables?
Should I use two route filters, one for each auth type?
If I only have one user table, should I use different groups (somehow - I'm not sure they'll built in?) or some indicator to let the system know whether it's a database-based, user/password login, or just a Facebook login?
since you are using facebook SDK,
you don't need a user table to begin with in most cases/projects.
if you indeed want to use two different authentication, then yes, use one for each auth type.
assign different routes for each of the case. don't need to bring all those different entities together and make a sandwich.
I want to implement an authentication system with a username and password of the users table.
I have 2 other tables and users_type1 users_type2 that contain a foreign key to the users table (fk_users).
My goal is to identify during the authentication if the user matches the type 1 or type 2 in order to redirect properly.
With the Symfony authentication system, I can not do it.
If I code everything myself without using the Symfony system, so I managed to do what I want.
My question is: What do you think to use Symfony2 without its authentication system?
You can use Symfony's RoleInterface to group users by their roles.
Symfony's documentation.
You can also control the redirect from a form parameter.