coder-manjeet wrote a reply+100 XP
6mos ago
@jussimannisto I thank you for replying,
Apologies for my incomplete context in my question.
I was working on a project when I noticed this and I never worked with ziggy before, we need to make sure, we should only expose the routes based on the access level to public or private routes.
For that I updated only the config/ziggy.js configuration and app/Middleware/HandleIneritiaRequests.php grouping technique, but still the unwanted routes was getting exposed in the js code on frontend, because I missed the last step to role based exposing the routes in app.blade.php. After this step it was working as expected:
{{-- Expose routes based on current user context --}}
@auth
@if (auth()->user()->hasRole('super-admin'))
@routes('admin')
@else
@routes('user')
@endif
@else
@routes('guest')
@endauth