2017 © Pedro Peláez
 

library navigation

Admin Architect - Navigation Module. Package provides easy way to build and store from/in database

image

adminarchitect/navigation

Admin Architect - Navigation Module. Package provides easy way to build and store from/in database

  • Tuesday, October 24, 2017
  • by endihunter
  • Repository
  • 1 Watchers
  • 1 Stars
  • 148 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 12 Versions
  • 7 % Grown

The README.md

Navigation

Navigation is a Laravel based (AdminArchitect oriented) package to handle dynamic menus. LinksProvider, RoutesProvider, EloquentProvider are provided out of the box., (*1)

Caution

Note, that adminarchitect/navigation is based on AdminArchitect package and won't work without it., (*2)

Installation

composer require adminarchitect/navigation

Add following lines to your config/app.php, (*3)

  • add Terranet\Navigation\ServiceProvider::class line to providers array
  • add 'Navigation' => Terranet\Navigation\Facade::class, line to aliases array

Run:, (*4)

php artisan vendor:publish --provider="Terranet\\Navigation\\ServiceProvider"
php artisan navigation:table
php artisan migrate

Providers

Navigation is based on Providers, each of them can provide a collection of navigable items and should realize one of default contracts or maybe define new one., (*5)

  • LinksProvider: Provides a way to add static links: url => title;
  • RoutesProvider: Provides a way to add routes to menu;
  • EloquentProvider: Provides a way to add Eloquent models to a navigable collection.

All usable providers are registered via config/navigation.php file -> providers array., (*6)

To create a new provider, run: php artisan navigation <Name>, then register it in config/navigation.php., (*7)

Any provider which extends EloquentProvider should provide a collection of items which implement NavigationItem contract. NavigationItem requires implementation of 3 simple methods: 1. navigationKey => should return item unique key, usually id; 2. navigationTitle => should return item title, may be: title, name, whatever identifies a model title. 3. navigationUrl => should return item specific url, may return url(<url>) or route(<name>, <params>), (*8)

for instance, to allow adding Posts to a navigation you have to create a PostsProvider, then modify your Post model to look like in the following example:, (*9)

php artisan navigation:provider PostsProvider

Provider command will generate app\Http\Terranet\Administrator\Navigation\Providers\PostsProvider class:, (*10)

<?php

namespace App\Http\Terranet\Administrator\Navigation\Providers;

use Terranet\Navigation\Providers\EloquentProvider;

class PostsProvider extends EloquentProvider
{
    /**
     * Eloquent model.
     */
    protected $model;
}

Now you only have to provide a valid eloquent $model, for instance App\Post:, (*11)

protected $model = \App\Post::class;

Next, register it in config/navigation.php, (*12)

'providers' => [
    ...
    \App\Http\Terranet\Administrator\Navigation\Providers\PostsProvider::class,
    ...
]

Navigable Eloquent model should implement NavigationItem contract, so App\Post should be like:, (*13)

class Post extends Model implements NavigationItem
{
    protected $fillable = [
        'user_id', 'title', 'slug', 'published', 'image',
    ];

    public function navigationKey()
    {
        return $this->id;
    }

    public function navigationTitle()
    {
        return $this->title;
    }

    public function navigationUrl()
    {
        return route('posts.show', ['slug' => $this->slug]);
    }
}

Enjoy!

The Versions

24/10 2017

dev-master

9999999-dev

Admin Architect - Navigation Module. Package provides easy way to build and store from/in database

  Sources   Download

The Requires

 

by endi

laravel navigation admin architect menu builder laravel admin laravel backend panel laravel administration framework

11/10 2017

v2.1

2.1.0.0

Admin Architect - Navigation Module. Package provides easy way to build and store from/in database

  Sources   Download

The Requires

 

by endi

laravel navigation admin architect menu builder laravel admin laravel backend panel laravel administration framework

04/10 2017

v2.0.2

2.0.2.0

Admin Architect - Navigation Module. Package provides easy way to build and store from/in database

  Sources   Download

The Requires

 

by endi

laravel navigation admin architect menu builder laravel admin laravel backend panel laravel administration framework

20/09 2017

v2.0.1

2.0.1.0

Admin Architect - Navigation Module. Package provides easy way to build and store from/in database

  Sources   Download

The Requires

 

by endi

laravel navigation admin architect menu builder laravel admin laravel backend panel laravel administration framework

18/08 2017

v2.0.0

2.0.0.0

Admin Architect - Navigation Module. Package provides easy way to build and store from/in database

  Sources   Download

The Requires

 

by endi

laravel navigation admin architect menu builder laravel admin laravel backend panel laravel administration framework

01/08 2017

v1.3.1

1.3.1.0

Admin Architect - Navigation Module. Package provides easy way to build and store from/in database

  Sources   Download

The Requires

 

by endi

laravel navigation admin architect menu builder laravel admin laravel backend panel laravel administration framework

28/06 2017

v1.2

1.2.0.0

Admin Architect - Navigation Module. Package provides easy way to build and store from/in database

  Sources   Download

The Requires

 

by endi

laravel navigation admin architect menu builder laravel admin laravel backend panel laravel administration framework

06/04 2017

v1.1.3

1.1.3.0

Admin Architect - Navigation Module. Package provides easy way to build and store from/in database

  Sources   Download

by endi

laravel navigation admin architect menu builder laravel admin laravel backend panel laravel administration framework

28/03 2017

v1.1.2

1.1.2.0

Admin Architect - Navigation Module. Package provides easy way to build and store from/in database

  Sources   Download

by endi

laravel navigation admin architect menu builder laravel admin laravel backend panel laravel administration framework

28/03 2017

v1.1.1

1.1.1.0

Admin Architect - Navigation Module. Package provides easy way to build and store from/in database

  Sources   Download

by endi

laravel navigation admin architect menu builder laravel admin laravel backend panel laravel administration framework

28/03 2017

v1.1

1.1.0.0

Admin Architect - Navigation Module. Package provides easy way to build and store from/in database

  Sources   Download

by endi

laravel navigation admin architect menu builder laravel admin laravel backend panel laravel administration framework

18/11 2016

v1.0

1.0.0.0

Admin Architect - Navigation Module. Package provides easy way to build and store from/in database

  Sources   Download

The Requires

  • terranet/administrator ^3.1

 

by endi

laravel navigation admin architect menu builder laravel admin laravel backend panel laravel administration framework