From ecaaffec8d67a0f46645452f0f563380d85f7e3a Mon Sep 17 00:00:00 2001 From: David Mathews Date: Sat, 26 Dec 2015 17:16:43 -0500 Subject: [PATCH] fixes for 5.0.11 --- changelog.md | 4 ++++ docs/configuration.md | 13 +++++++++++++ readme.md | 6 +++++- src/Frozennode/Administrator/Config/Factory.php | 4 +++- src/routes.php | 11 ++++++++++- 5 files changed, 35 insertions(+), 3 deletions(-) diff --git a/changelog.md b/changelog.md index 475081854..f8636f8d8 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,9 @@ ## Changelog +### 5.0.11 +- Bugfix: Had to make the middleware additon backwards compatable +- Docs: Added doc updates + ### 5.0.10 - Bugfix: L5.2 changed the way url() works so added url('/') instead - Added: Support for middleware additions to the Admin routes via the administrator config diff --git a/docs/configuration.md b/docs/configuration.md index cc36c57d5..7bb55ce69 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -27,6 +27,7 @@ Below is a list of all the available options: - [Uri](#uri) - [Domain](#domain) +- [Middleware](#middleware) - [Title](#title) - [Model Config Path](#model-config-path) - [Settings Config Path](#settings-config-path) @@ -66,6 +67,18 @@ This is the base route for the administrator package to be called on. This is the base domain for the administrator route. This can allow you to lock down the admin to just a certain domain/subdomain. + +### Middleware + + /** + * Admin Routes Additional Middleware + * + * @type array + */ + 'middleware' => '', + +This is the additional middlewares that you wish to run on administrator route. + ### Title diff --git a/readme.md b/readme.md index e29ba057e..79328510d 100644 --- a/readme.md +++ b/readme.md @@ -4,7 +4,7 @@ Administrator is an administrative interface builder for [Laravel](http://larave - **Author:** Jan Hartigan - **Website:** [http://frozennode.com](http://administrator.frozennode.com/) -- **Version:** 5.0.10 +- **Version:** 5.0.11 [![Build Status](https://travis-ci.org/FrozenNode/Laravel-Administrator.png?branch=master)](https://travis-ci.org/FrozenNode/Laravel-Administrator) @@ -63,6 +63,10 @@ Administrator is released under the MIT License. See the LICENSE file for detail ## Recent Changelog +### 5.0.11 +- Bugfix: Had to make the middleware additon backwards compatable +- Docs: Added doc updates + ### 5.0.10 - Bugfix: L5.2 changed the way url() works so added url('/') instead - Added: Support for middleware additions to the Admin routes via the administrator config diff --git a/src/Frozennode/Administrator/Config/Factory.php b/src/Frozennode/Administrator/Config/Factory.php index 10743b6ef..f2319fb73 100644 --- a/src/Frozennode/Administrator/Config/Factory.php +++ b/src/Frozennode/Administrator/Config/Factory.php @@ -72,6 +72,8 @@ class Factory { protected $rules = array( 'uri' => 'required|string', 'title' => 'required|string', + 'domain' => 'string', + 'middleware' => 'array', 'model_config_path' => 'required|string|directory', 'settings_config_path' => 'required|string|directory', 'menu' => 'required|array|not_empty', @@ -328,4 +330,4 @@ public function fetchConfigFile($name) return false; } -} \ No newline at end of file +} diff --git a/src/routes.php b/src/routes.php index 731eb9e3e..dcd6b9332 100644 --- a/src/routes.php +++ b/src/routes.php @@ -2,10 +2,19 @@ use Illuminate\Support\Facades\Route; +/** + * Temperary solution for middleware in routes + * TODO: remove in favor of setting the config for middleware outside of the routes file + */ +$middleware_array = array('Frozennode\Administrator\Http\Middleware\ValidateAdmin'); +if(is_array(config('administrator.middleware'))) { + $middleware_array = array_merge(config('administrator.middleware'), $middleware_array); +} + /** * Routes */ -Route::group(array('domain' => config('administrator.domain'), 'prefix' => config('administrator.uri'), 'middleware' => [implode(',',config('administrator.middleware')), 'Frozennode\Administrator\Http\Middleware\ValidateAdmin']), function() +Route::group(array('domain' => config('administrator.domain'), 'prefix' => config('administrator.uri'), 'middleware' => $middleware_array), function() { //Admin Dashboard Route::get('/', array(