From 1fa51927bbb9f6ebe3c4d58b65571fba11aded24 Mon Sep 17 00:00:00 2001 From: printempw Date: Sun, 4 Sep 2016 15:47:51 +0800 Subject: [PATCH] use composer to load helpers --- app/Providers/AppServiceProvider.php | 5 ++--- composer.json | 5 ++++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index dec9c2e5..ec7ff29b 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -2,6 +2,7 @@ namespace App\Providers; +use View; use Validator; use Illuminate\Support\ServiceProvider; @@ -14,9 +15,7 @@ class AppServiceProvider extends ServiceProvider */ public function boot() { - \View::addExtension('tpl', 'blade'); - - require_once BASE_DIR."/app/helpers.php"; + View::addExtension('tpl', 'blade'); Validator::extend('username', function($attribute, $value, $parameters, $validator) { return preg_match("/^([A-Za-z0-9\x{4e00}-\x{9fa5}_]+)$/u", $value); diff --git a/composer.json b/composer.json index 34a2c9f6..797acfc9 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,10 @@ ], "psr-4": { "App\\": "app/" - } + }, + "files": [ + "app/helpers.php" + ] }, "autoload-dev": { "classmap": [