V
V
Vladislav2017-03-28 08:44:52
Laravel
Vladislav, 2017-03-28 08:44:52

How to implement so that each user has his own added content?

There is a controller
Here is a piece of code

public function index()
    {
        if(Sentinel::inRole('manager')){
            $us = User::where('id', Sentinel::getUser()->id)->get();
            $companys = Company::where('user_id', Sentinel::getUser()->id)->get();
        }else{
            $us = User::get();
            $companys = Company::get();
        }
        return view('auth.list', compact('us', 'companys'));
    }

Here's how to set each user to have their own added content in the admin panel (when you log in as a user)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question