How to display all data only admin?

Posted 1 year ago by irankhosravi

I want to display all data only admin in laravel. How do it?

public function index()
{
    if (auth()->loginUsingId(1))
    {
        $schools_lists = SchoolsList::latest()->paginate(25);
        return view('Admin.submit-information.all', compact('schools_lists'));
    }
    else
    {
        $schools_lists = SchoolsList::where('user_id', Auth::user()->id)->latest()->paginate(25);
        return view('Admin.submit-information.all', compact('schools_lists'));
    }
}

id : 1 = Administrator

Please sign in or create an account to participate in this conversation.