Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Jan 3, 2023. It is now read-only.
/ SimpleMenu Public archive

create menus that support page (multiLocale "title, url, body, ...", nesting, template, static/dynamic data, roles & permissions).

License

Notifications You must be signed in to change notification settings

ctf0/SimpleMenu

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SimpleMenu
Latest Stable Version Total Downloads

Create menus & pages that support (multiLocale "title, url, body, ...", nesting, template, static & dynamic data, roles & permissions).

  • package requires Laravel v5.5+
  • package rely heavily on caching so make sure to install one of the tag enabled drivers Memcached / Redis

Installation

  • composer require ctf0/simple-menu

  • after installation, run php artisan sm:setup to add

    • package routes to routes/web.php
    • package assets compiling to webpack.mix.js
  • publish the packages assets with php artisan vendor:publish

  • install JS dependencies

    yarn add vue axios vue-tippy@v2 vuedraggable vue-notif vue-multi-ref vue-awesome@v2 list.js
  • add this one liner to your main js file and run npm run watch to compile your js/css files.

    • if you are having issues Check.
    // app.js
    
    window.Vue = require('vue')
    
    require('../vendor/SimpleMenu/js/manager')
    
    new Vue({
        el: '#app'
    })

Config

config/simpleMenu.php

return [
    /*
     * the menu list classes to be used for "render()"
     */
    'listClasses' => [
        'ul' => 'menu-list',
        'li' => 'list-item',
        'a' => 'is-active',
    ],

    /*
     * the path where we will save the routes list
     */
    'routeListPath' => storage_path('logs/simpleMenu.php'),

    /*
     * where to redirect when a route is available in one locale "en" but not in another "fr" ?
     */
    'unFoundLocalizedRoute' => 'root',

    /*
     * package models
     */
    'models'=> [
        'user' => App\User::class,
        'page' => \ctf0\SimpleMenu\Models\Page::class,
        'menu' => \ctf0\SimpleMenu\Models\Menu::class,
    ],

    /*
     * when adding a page which is a nest of a nother to a menu, ex.
     *
     * root
     *   | child 1
     *     | child 2 "add this along with its childrens to another menu"
     *       | child 3
     *
     * do you want to clear its parent and make it a root ?
     */
    'clearPartialyNestedParent' => true,

    /*
     * when removing a root page from a menu, ex.
     *
     * root "remove"
     *   | child 1
     *     | child 2
     *       | child 3
     *
     * do you want clear all of its 'Descendants' ?
     */
    'clearRootDescendants' => false,

    /*
     * when removing a nest from a list, ex.
     *
     * root
     *   | child 1
     *     | child 2 "remove"
     *       | child 3
     *
     * do you want to reset its hierarchy ?
     */
    'clearNestDescendants'=> false,

    /*
     * when deleting a page "from the db", ex.
     *
     * page "delete/destroy"
     *   | nested child 1
     *     | nested child 2
     *       | nested child 3
     *
     * do you also want to delete all of its children ?
     */
    'deletePageAndNests' => false,

    /*
     * package routes url & route name prefix
     */
    'crud_prefix' => 'admin',

    /*
     * all the package controllers
     *
     * if you need to change anything, just create new controller
     * and extend from the below original
     * ex. "class ExampleController extends PagesController"
     */
    'controllers'=> [
        'permissions' => '\ctf0\SimpleMenu\Controllers\Admin\PermissionsController',
        'admin' => '\ctf0\SimpleMenu\Controllers\Admin\AdminController@index',
        'users' => '\ctf0\SimpleMenu\Controllers\Admin\UsersController',
        'pages' => '\ctf0\SimpleMenu\Controllers\Admin\PagesController',
        'roles' => '\ctf0\SimpleMenu\Controllers\Admin\RolesController',
        'menus' => '\ctf0\SimpleMenu\Controllers\Admin\MenusController',
    ],
];

Usage

Demo
Usage
Views

  • add SMUsers trait to your User Model

    use ctf0\SimpleMenu\Models\Traits\SMUsers;
    
    // ...
    
    class User extends Authenticatable
    {
        use Notifiable, SMUsers;
    }
  • visit localhost:8000/admin

About

create menus that support page (multiLocale "title, url, body, ...", nesting, template, static/dynamic data, roles & permissions).

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published
Morty Proxy This is a proxified and sanitized view of the page, visit original site.