2017 © Pedro Peláez
 

laravel auto_route

laravel General Route : to allow You not to put every general route in the route file

image

hosamaldeen/auto_route

laravel General Route : to allow You not to put every general route in the route file

  • Tuesday, October 31, 2017
  • by hosamaldeen
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

laravel auto route

laravel General Route to allow You not to put every general route in the route file, (*1)

Installation

run this command composer require hosamaldeen/auto_route, (*2)

Route Rules

there are 4 ways for general routes based on the count of the segments * Urls that include 1 segments like /product
will request ProductController@index, (*3)

  • Urls that include 2 segments /product/all
    will request ProductController@all, (*4)

  • Urls that include 2 segments and the second segment is number like /product/1
    will request ProductController@view
    and pass the value to the function as {id}, (*5)

  • Urls that include 3 segments /product/search/1
    will request ProductController@search
    and pass the value to the function as {id}, (*6)

Usage

in your route file add this, (*7)

$defaultRoute = new HosamAldeen\AutoRoute\Route;
$defaultRoute->create();

you can add some options to your routes, (*8)

$defaultRoute = new HosamAldeen\AutoRoute\Route;
$defaultRoute->prefix = '';
$defaultRoute->middleware = [];
$defaultRoute->namespace = '';
$defaultRoute->create();

Full Example

$defaultRoute = new HosamAldeen\AutoRoute\Route; // frontend
$defaultRoute->create();

$defaultRoute = new HosamAldeen\AutoRoute\Route; //backend
$defaultRoute->prefix = '/backend';
$defaultRoute->middleware = ['web'];
$defaultRoute->namespace = 'Backend';
$defaultRoute->create();

The Versions

31/10 2017

dev-master

9999999-dev

laravel General Route : to allow You not to put every general route in the route file

  Sources   Download

proprietary

by Hossam ahmed