I have Voyager TCG 1.6 with Laravel 9 and PHP 8
I installed it and the /admin routes on the sidebar works perfect. But when a not admin logins on the /admin/login, Jetstream redirects you to the Common Dashboard.
So what I did was adding this to the Laravel default dashboard blade:
@extends('voyager::master')
@section('content')
<?php $page= App\Models\Producto::first(); ?>
{{-- // Model on bread system --}}
@can('browse',$page)
<p>You can browse pages</p>
@endcan
@endsection
and the Menu shows up with nothing, when you add a custom URL link it shows up, but I think I'm not understanding how to show a menu to each user depending the role they have.
Here my 2 questions:
1)Is it possible to assign/show/use a different Menu depending on the role/permissions?
2)Is there a way a Not Admin user can access the BREADS on the /admin/routes(roles/permissions/categories/others)?
(For example: when i try to go to localhost/admin/products with a Normal User role, and that role has the permission to browse that BREAD, the user is redirected to 'localhost')
I'm pretty sure this has something to do with the Voyager Defaults Routes for Laravel:
Route::group(['prefix' => 'admin'], function () {
Voyager::routes();
});
My guess is that there is a way to tackle these both problems and I'm not seeing the way everyone uses this Voyager Package.
If anyone here uses this package I will appreciate your help since the Voyager Documentation is not very clear on this. Best practices are always welcome, if I'm not able to solve this the only solution that came to my mind is the old fashion way, creating a custom sidebar for users based on the table users, column role_id.