Download the PHP package adminarchitect/navigation without Composer
On this page you can find all versions of the php package adminarchitect/navigation. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download adminarchitect/navigation
More information about adminarchitect/navigation
Files in adminarchitect/navigation
Package navigation
Short Description Admin Architect - Navigation Module. Package provides easy way to build and store from/in database
License
Informations about the package navigation
Navigation
Navigation is a Laravel based (AdminArchitect oriented) package to handle dynamic menus. LinksProvider, RoutesProvider, EloquentProvider are provided out of the box.
Caution
Note, that adminarchitect/navigation
is based on AdminArchitect package and won't work without it.
Installation
Add following lines to your config/app.php
- add
Terranet\Navigation\ServiceProvider::class
line toproviders
array - add
'Navigation' => Terranet\Navigation\Facade::class,
line toaliases
array
Run:
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.
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.
To create a new provider, run: php artisan navigation <Name>
, then register it in config/navigation.php.
Any provider which extends EloquentProvider should provide a collection of items which implement NavigationItem contract. NavigationItem requires implementation of 3 simple methods:
- navigationKey => should return item unique key, usually
id
; - navigationTitle => should return item title, may be:
title
,name
, whatever identifies a model title. - navigationUrl => should return item specific url, may return
url(<url>)
orroute(<name>, <params>)
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:
Provider
command will generate app\Http\Terranet\Administrator\Navigation\Providers\PostsProvider
class:
Now you only have to provide a valid eloquent $model, for instance App\Post
:
Next, register it in config/navigation.php
Navigable Eloquent model should implement NavigationItem contract, so App\Post
should be like: