Skip to content

Instantly share code, notes, and snippets.

@atrauzzi
Created December 6, 2013 16:04
Show Gist options
  • Save atrauzzi/7827217 to your computer and use it in GitHub Desktop.
Save atrauzzi/7827217 to your computer and use it in GitHub Desktop.
Static route helpers.
<?php namespace My\Namespace;
use Illuminate\Support\Facades\Route;
class Routes {
public static function all() {
static::allDevice();
static::allPlatform();
}
public static function allDevice($prefix = 'device') {
Route::group(['prefix' => $prefix], function () {
static::deviceStore();
static::deviceUpdate();
static::deviceShow();
});
}
public static function deviceStore() {
Route::post('', 'My\Namespace\Controller\Device@store');
}
public static function deviceUpdate() {
Route::post('{id}', 'My\Namespace\Controller\Device@update');
}
public static function deviceShow() {
Route::get('{id}', 'My\Namespace\Controller\Device@show');
}
public static function allPlatform($prefix = 'platform') {
Route::group(['prefix' => $prefix], function () {
static::platformIndex();
static::platformShow();
});
}
public static function platformIndex() {
Route::get('', 'My\Namespace\Controller\Platform@index');
}
public static function platformShow() {
Route::get('{id}', 'My\Namespace\Controller\Platform@show');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment