Comments (2)
Hello,
There is not a single place to edit the whole menu. I chose to split the menu into several files so that I could provide them in other packages.
For exemple, to add new menu items I create a new folder app/Menu
. Into this folder i put classes to add menu items, for exemple Shops.php (see the comments) :
<?php
namespace App\Menu;
use Sebastienheyd\Boilerplate\Menu\Builder;
class Shops
{
public function make(Builder $menu)
{
// You must have a route with the alias shops.index
// See font-awesome for icons, here fa-shopping-cart
$menu->add('Shops', [ 'route' => 'shops.index', 'icon' => 'shopping-cart' ])
->id('shops') // Menu item ID
->order(100) // This will manage the menu item "weight" to define his position
->activeIfRoute('shops.*'); // To set "active" css class on the menu item for all pages with route beginning with "shops."
}
}
After that, you need to declare it into config/boilerplate/menu.php
:
<?php
/**
* Define here every class you want to call to build the backend menu
* Every class need a method make(Builder $menu)
*
* @see \Sebastienheyd\Boilerplate\ViewComposers\MenuComposer
*/
return [
'providers' => [
\Sebastienheyd\Boilerplate\Menu\Users::class,
\Sebastienheyd\Boilerplate\Menu\Logs::class,
\App\Menu\Shops::class,
]
];
By doing this, you can deliver the file in a package and for example install it by making a vendor:publish
. The only condition is that you must add the line into config/boilerplate/menu.php
(I'm thinking on how i can do it magically).
You can watch in Users.php for adding sub items.
Permissions are linked to scripts, views, routes, ... this is why I use migrations and i'm not allowing to create them by a form... for this moment... ;)
from boilerplate.
Perfect! Got it this time! Menu is up and running now, will wait for the permissions update. The option to CRUD the permission would be cool, the whole back-end stuff could be taken care of by the dev himself. Atleast when I search for something like you did was simple. Easy code (which most of the part is in your code) and the CRUD options for user / role / permission managment. I can code everything else myself just the forms take way longer than I want to. :D
Thanks for the explanation. :)
from boilerplate.
Related Issues (20)
- How to send extra params to select2 ajax? HOT 1
- How to set min and max date using Carbon on datetimepicker? HOT 1
- Datatables doesn't display buttons
- Unknown column '_token' in 'field list' , Mass assignment issue HOT 1
- Not able to run tests HOT 5
- ID issue in Datatables class HOT 1
- [ENHANCEMENT] Repeatable component HOT 2
- how to use form component for modal form HOT 1
- [Question] - How to remove default menu items HOT 1
- Dark mode is not completely disabled HOT 1
- Error 500 Memory limit with a new user account and just backend access role HOT 7
- Suggestion to convert package into a Vue version HOT 1
- Textarea option not working in input component HOT 1
- Impersonate - too many redirects HOT 3
- How to update package ? HOT 1
- Permission always return false HOT 1
- Datatable row color HOT 1
- [Datatables] Hide columns based on ajax propery
- [Enhancement] Set max column render width on datatables HOT 2
- Remove keep-alive session
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from boilerplate.