functioncan_view(string$scope,int$owner_id):bool{$user=Auth::user();if(!$user||!method_exists($user,"hasRole")||!property_exists($user,"id")){throw"Error : Current User state is undetermined"}return$scope==='public'||$user->id===$owner_id||$user->hasRole('admin');}
taking advantages of boolean shortcuts : assuming that the owner of content is always allowed to view whatever $scope it is
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
because i don't trust frameworks blindly:
taking advantages of boolean shortcuts : assuming that the owner of content is always allowed to view whatever $scope it is