2017 © Pedro Peláez
 

library laravel-support-controllers

A set of support classes/traits for Laravel Controller

image

pion/laravel-support-controllers

A set of support classes/traits for Laravel Controller

  • Tuesday, June 21, 2016
  • by pionl
  • Repository
  • 1 Watchers
  • 0 Stars
  • 43 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Traits

Requirements

  • Laravel 5.1+ or 5.2+

Install

Without Crumbs, (*1)

composer require pion/laravel-support-controllers

With Crumbs, (*2)

composer require pion/laravel-support-controllers
composer require atorscho/crumbs 2.2

URLTrait

Adds a new set of protected functions for the current controller. Enables getting the controller name with the namespace without the controllers namespace (for custom namespace overide the "getControllersRootNamespace" method). Also you can get current url, controllers action string for URL and controllers URL for given action., (*3)

Methods

getCurrentActionForName($action);
getCurrentActionURL($action, $parameters = []);
getControllerName();
getCurrentFullURL();

AbstractNavigationTrait

Loads the URLTrait and enables creating a navigation for a resource controller (or any controller). Support creating current page link, current page link with a link to a list page (index page), models name and link to detail action (or edit and etc). Samples of url can be:, (*4)

Examples

  • set listTitle on construct (list page)
  • the model must implement getName function (you can use NavigationModelTrait) to enable further functions in future

/sites - call the createNavigation() without title Result: list page, (*5)

/sites/create - call the createNavigation("New page"); Result: list page -> New page, (*6)

/sites/1/edit - call the createNavigation("Edit", $object); Result: list page -> name -> Edit, (*7)

/sites/1/edit - model has no detail view, call the createNavigation("Edit", $object); Result: list page -> name, (*8)

etc., (*9)

Customizations

You can change some properties: - $listModelAction the controllers action name for a list - $detailModelAction the controllers action name for the detail action (default is show, can be edit if not supported) - $listTitle the title for the list, (*10)

You can handle some states when the createNavigation is triggered:, (*11)

beforeAddingListNavigation($title = null, $modelToShow = null)

Triggered before adding a list navigation. Called only if list page is supported, (*12)

beforeAddingModelActionNavigation($model, $title = null)

Triggered before the model action is added (edit/show/etc), (*13)

addCrumbNavigationToList

Calls the addNavigation with list action, (*14)

addCrumbNavigationForModel

Calls the addNavigation with given url and the model names, method must return bool if the navigation was added., (*15)

CrumbsNavigationTrait

Implements the Crumbs navigation with AbstractNavigationTrait trait, (*16)

The Versions

21/06 2016

dev-master

9999999-dev

A set of support classes/traits for Laravel Controller

  Sources   Download

MIT

The Requires

 

The Development Requires

21/06 2016

v1.0.2

1.0.2.0

A set of support classes/traits for Laravel Controller

  Sources   Download

MIT

The Requires

 

The Development Requires

03/02 2016

v1.0.1

1.0.1.0

A set of support classes/traits for Laravel Controller

  Sources   Download

MIT

The Requires

 

The Development Requires

03/02 2016

v1.0

1.0.0.0

A set of support classes/traits for Laravel Controller

  Sources   Download

MIT

The Requires

 

The Development Requires