Get 2024 Templates Mega Bundle!$1000 worth of 19 Bootstrap HTML, Vue & React Templates + 3 Vector Sets for just $99
Get for 99$

Metronic : Permission and Role Laravel


how is pattern in an array for permission and role ? it can config in config/menu.php I guess. But I don't know how ?

ps. Sorry My English isn’t that good


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 Adobez,

If you are using this plugin as a permission/role module, you can use the "role" or "permission" option in the menu.
https://spatie.be/index.php/docs/laravel-permission/v5/installation-laravel

Example of menu config below.


array(
"title" => "Troubleshoot",
"path" => "documentation/getting-started/troubleshoot",
"role" => "admin",
),


In the menu class, we added condition to check the menu item for current auth user. The menu will be removed if the current has no permission to view it.
app/Core/Adapters/Menu.php


$user->hasAnyRole((array) $value["role"])


<img src="https://i.ibb.co/ssbsJHx/o3i-Kp-UTGPm-VXv-Go-NB2-Y-Mpn34-Bm4j-XTwpw.png" alt="o3i-Kp-UTGPm-VXv-Go-NB2-Y-Mpn34-Bm4j-XTwpw" border="0">

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  :(