Welcome Guest, Not a member yet? Register   Sign In
Shield: access of a page for one user
#11

(12-30-2022, 06:02 AM)groovebird Wrote:
(12-30-2022, 12:17 AM)InsiteFX Wrote: No you can create Groups and give the Groups Permission access rules.

Yes, but a "group" only consists of one user, because only one user has access to this page. It is like a profile page. The contents of the page for every user are different. I only have to connect the contents (stored in a view or database) with a user id.

User A has access to page A
User B has access to page B ...

If I understand you properly, what you are looking for is not really a group/permission related issue.

What you are looking for is how to display a user profile page per user, for instance;
A: example.com/user/user_a ~ My name is "User A"
B: example.com/user/user_b ~ My name is "User B"
C: example.com/user/user_c ~ My name is "User B"

If that is the case, define a method/function in your controller and name it `show($user_id)`.

Each call to this method is expected to provide a parameter; `$user_id`

Inside of the method, call your user model and find the user id; `$user = model(App\Models\UserModel::class)->find($user_id);` for instance.

Now, pass the `$user` variable to the view.

In your view page, you can now interact with the user property for each users. Mostly, the view is just the same, but with dynamic content ($user);

Thanks.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB