Get 2024 Templates Mega Bundle!14 Bootstrap, Vue & React Templates + 3 Vector Sets
Get for 99$

Laravel app global/menu.php


Hello, I'm using your Laravel app theme, and I've been struggling to activate the role and permission sections in the global/menu.php file. I can't seem to assign middleware to routes through the menu. Does the theme support this feature?

<?php

return array(
// Documentation menu
'documentation' => array(
// Getting Started
array(
'heading' => 'Getting Started',
),

// Overview
array(
'title' => 'Overview',
'path' => 'documentation/getting-started/overview',
// 'role' => ['admin'], <---this part
// 'permission' => [], <---this part
),


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (1)


Hi Ibrahim,

To activate the role and permission sections in the global/menu.php file of the Laravel app theme, you need to implement the user's role using the Laravel Permission package. You can refer to the documentation at https://spatie.be/docs/laravel-permission/v5/introduction for detailed instructions on how to define user roles.

The theme already includes integration for the menu part, which hides certain menu items based on the user's role. The menu function responsible for this is defined in the app/Core/Adapters/Menu.php file, specifically the filterMenuPermissions method.

By defining the user's role and assigning appropriate permissions, you'll be able to control access to specific menu items based on the user's role. Please refer to the Laravel Permission documentation for more information on how to define roles and manage permissions.

If you encounter any further issues or need additional assistance, feel free to ask for help.

Thanks


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(