brightly/mango

Brightly Mango CMS

dev-staging 2020-05-13 13:44 UTC

README

Mango (Ambient edition)

Intruduction

Install

As you started your project with brightly/mango-starter Mango is added to your composer.json, and prepared to use.

Migrations

Mango registers its own database migration files, so they'll be created as you run

artisan migrate

If you want to change something on those migration files, you can publish migration files, and edit them via:

artisan vendor:publish --tag=mango-migrations

Admin (Nova)

First you have to publish the Nova source code:

artisan vendor:publish --tag=mango-nova-dev

To be able to use the Nova you have to add these things to your composer.json:

    ...
    "require": {
        ...
        "laravel/nova": "*",
        "benjaminhirsch/nova-slug-field": "^1.2",
        ...
    },
    ...
    "repositories": [
        ...
        {
            "type": "path",
            "url": "./nova"
        },
        ...
    ],

...and then run:

composer update```
artisan nova:install
artisan vendor:publish --tag=mango-nova

...to create a default user:

artisan nova:user

Usage

Menu

Mango handling menus for site navigation: By handling multiple menus you can separate header, footer or main menu. Of course all of them can exists on different languages in an independent structure. Menus defined by a high level menu identifier, the type of these is menu. Above that we can define groups - groups - what can have more single items, and single items. Single items can handle different type of links:

  • url is for inside page links, Laravel's url(...) method will be applied on these.
  • href is a regular link to outside, we're not going to do anything with that. (This is for foreign links.)
  • route is for routes, what are defined by the developers. Laravel's route(...) method will be applied on this. This is good for changing locale, log in or log out functions.
Blade Functions

In Blade sitebuilders can use @menu('slug') conditional directive to check, whether the menu exists or not. Of course @else and @endmenu also exists. There is a global $menu variable in the templates as the @inject('menu', 'Brightly\Mango\Services\MenuService') Blade directive is used.

@menu('slug')
    // We have menu items
    @foreach ($menu->menu('slug')->items as $menu_item)
        <a href="{{ $menu_item->link }}">{{ $menu_item->title }}</a>
    @endforeach
@else
    //- There are no items in the menu.
@endmenu