use composer to load helpers

This commit is contained in:
printempw 2016-09-04 15:47:51 +08:00
parent 681a56a741
commit 1fa51927bb
2 changed files with 6 additions and 4 deletions

View File

@ -2,6 +2,7 @@
namespace App\Providers; namespace App\Providers;
use View;
use Validator; use Validator;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
@ -14,9 +15,7 @@ class AppServiceProvider extends ServiceProvider
*/ */
public function boot() public function boot()
{ {
\View::addExtension('tpl', 'blade'); View::addExtension('tpl', 'blade');
require_once BASE_DIR."/app/helpers.php";
Validator::extend('username', function($attribute, $value, $parameters, $validator) { Validator::extend('username', function($attribute, $value, $parameters, $validator) {
return preg_match("/^([A-Za-z0-9\x{4e00}-\x{9fa5}_]+)$/u", $value); return preg_match("/^([A-Za-z0-9\x{4e00}-\x{9fa5}_]+)$/u", $value);

View File

@ -23,7 +23,10 @@
], ],
"psr-4": { "psr-4": {
"App\\": "app/" "App\\": "app/"
} },
"files": [
"app/helpers.php"
]
}, },
"autoload-dev": { "autoload-dev": {
"classmap": [ "classmap": [