how records if user admin, if not admin return user posts. try
where('iduser',"=",$idcurrentuser)->orwhere('administrador','=','administrador')->get();
thanks in advance
it's how check user not admin
part, auth::user(), point apply $query->where
inside main where
if current user in not admin
->where(function($query) use ($idcurrentuser) { if (/* user not admin */) { $query->where('iduser',"=",$idcurrentuse); } })->get();
Comments
Post a Comment