How to make user email unique based on user roles - laravel

I am new to laravel i am using laravel 6x.
Now i want to know how to make user email unique based on user roles .I am using spatie permissions
I have two type of users
admin
End user
Now i want to use laravel validation for same email for different roles,that means, email should be unique by roles.
Anybody has any idea, please let me know

Related

Laravel Nova custom action

I have just started using Laravel Nova and need to create some sort of custom action.
Within my Nova Dashboard I would like to have a button to create a new User.
I also need to generate a password and choose from a role for this user.
If User has role admin I will need to send user password per email.
What is the best way to have this action inside Nova?
Thanks!

How do you create multiple registration in laravel

I'm using laravel 6 and I want to create an app with two different users. One user is a user registering on the app as an individual while the other user is a user registering on behalf of a company/organization.
For an individual user, firstname, lastname, email and password fields are required while for the company/organization, the companyname, email and password are required. I would like to have two registration forms to register the two types of users.
I have searched for a similar question but the one I found on this platform wasn't answered. Kindly help.
Seems to me that this tutorial could be what you're looking for: https://laravelarticle.com/laravel-multi-authentication
It creates authentication system for two user groups - regular and admin users.

Authenticate by one of multiple email addresses per user

A user can have multiple emails. I got two tables "users" and "user_emails". Registration is working fine and it writes the email to user_emails.
Later the users shell be able to add more email-adresses within a backend gui. Now i am stuck with the verification at login, as a user should be able to use any of the email adresses out of "user_emails" with the passwort out of "users".
What do i have to do to get this working?
Thank you.

How can i give perfect relationship each other table?

i am confuse about database relationship...I am creating website like classified ads..without registartion how user can post??
Registration users and without registration users form are same...but how to store data without registartion user
This is form
This is database
user.id is required on your Advertise table only. So, what you can do is first set the user_id on Advertise table that way you can have advertises from registered users and non users.
So if a particular user can check his ads then he can check his ads.
About the unauthenticated users they wont have the deligacy of viewing their ads.
Or you can do something like :
Check auth()->check() if auth exists then give that form if doesn't then get the unregistered user email and give the services of checking ads with email

Spark: Assigning Roles to Invited Users

Using Laravel Spark, is there a way to -- either via UI or programmatically -- assign a team role to an invited user?
That is, Laravel Spark doesn't allow admins to create users. Instead, a owner user invites them. This creates an entry in the invitations table, and sends an email URL to the potential user. Users can then follow this URL, and sign up for a user account. Once they've signed up, an admin can change their role via UI.
Laravel Spark lets you set a default role for all invited users. What I want to know is: Does Laravel Spark provide a mechanism that would let me invite user A and have them end up with role B, and invite user C and have them end up with role D.
I can think of a number of ways to achieve this myself with custom code, but before I do that I want to know if this wheel's been invented.
Spark Roles is useful as it will allow you to assign user roles/permissions as the user signs up and/or is assigned to a team. https://github.com/centrality-labs/spark-roles

Resources