Laravel 5.1 Sync user to other users - laravel

I build a Laravel app.
In table users I have 2 kinds of users - one user is restaurants and another user is restaurant stuff.
What I exactly need?
I want to sync user (res stuff) to user (restaurant). Is that possible or I need to move the restaurant to the other table and then sync?
I'm looking just for the idea and is that possible?
What is the difference between the user in the same table is admin field - res users have value '999' at admin column and res stuff has value '1' at admin column.

Related

User and Admin relationship in spring boot

Roles tables only two roles Admin and User only. ( Static table)
Admin
User
User tables - whenever user register the page, it will automatically comes (2- User (Roles table)
Ex.
Si.no . Name address email rollid
1 xxx yyyy zzzz 2-(Roles table ) Users only registered so Users no 2 come from Roles table
Doubt?
What is the relationship between them
ManyTomany or Onetoone
. Many users have many roles. But my case one user object have one role only.. Which one is correct? Then how can insert value 2 to user table whenever user register the page. Please advice
Two tables is enough no need for third table

Laravel multi-auth different table for admin and user but one login page

Is it possible to have two different tables for users and admin but one login page? I already used middleware and Spatie permission, but I need them to separate because some info doesn't match if they are together in one table.
For example:
Admin needs name, employee number. At the same time, users need a name, address, student number, etc.
I need suggestions on how to do that to study it.

Show particular data in dropdown

How to exclude database row from the select menu ? For example: The admin can create user and append roles to them. The available roles are dev, admin, normal user. But the admin user have to see only the admin and normal user roles. I know I can add them in the BREAD menu but I want to restrict the vision on dev role and when another roles are added to show them automaticaly and not to add them on by one in the BREAD menu.
The simplest solution is to filter the set of roles pulled from the database. Since I am not familiar with your database schema, here is a rough solution that you should be able to tweak to your needs
$rolesQuery = Role::newQuery();
if (Auth::user()->is_admin) {
$rolesQuery->where('role', '!=', 'dev');
}
$roles = $rolesQuery->get();
You can cache this result for admins for future use.

Multi Tenancy approach - UserId to N Tenants

Can I register same user (login/e-mail) in more than on tenant, so an UserId can belong to multiple Tenants?
I ask that because instead of input Tenant on login, How hard is to achieve this approach below?
When user logs in, if they belong to multiple tenants, boilerplate will identify this and show the user a select dropdown to choose which tenant they want to manage.
I feel this approach is more professional than input a tenant string value on login page.
it's not possible in aspnetboilerplate structure. a user must belong to only a single tenant.

Correct Many to Many friends relationship for users

What is the correct way to relate users in parse to one another as friends?
I also want users to be able to query other users but not see all fields, like emails. Is there a way I can create a view on the users table with cloud code, and only return this to the client code?
I was thinking I can create a friends table that will have two columns with 2 pointers, 1 for each user.
thanks for any advice.
I was thinking I can create a friends table that will have two columns with 2 pointers, 1 for each user.
I'll do that too, with a status column to handle pending, blocked...etc
I also want users to be able to query other users but not see all fields, like emails.
You have to add a privateData column on user with ACL restricted to owner only, which would contain private infos such as emails...etc

Resources