123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- <?php
- namespace App\Base\Providers;
- use App\Activity\Providers\ActivityServiceProvider;
- use App\Admin\Providers\AdminServiceProvider;
- use App\Api\Providers\ApiServiceProvider;
- use App\Attachment\Providers\AttachmentServiceProvider;
- use App\Base\Facades\AliPayFacade;
- use App\Base\Facades\ApiSysUserFacade;
- use App\Base\Facades\ObsFacade;
- use App\Base\Facades\PaypalPayFacade;
- use App\Base\Facades\PinYinFacade;
- use App\Base\Facades\SmsFacade;
- use App\Base\Facades\UploadFacade;
- use App\Base\Facades\WechatPayFacade;
- use App\Base\Models\ComOssETagModel;
- use App\Base\Services\AliPayService;
- use App\Base\Services\ApiSysUserService;
- use App\Base\Services\ObsService;
- use App\Base\Services\PaypalPayService;
- use App\Base\Services\PinYinService;
- use App\Base\Services\SmsService;
- use App\Base\Services\UploadService;
- use App\Base\Services\WechatPayService;
- use App\Basic\Providers\BasicServiceProvider;
- use App\Blog\Providers\BlogServiceProvider;
- use App\Crontab\Providers\TaskServiceProvider;
- use App\Doc\Providers\DocServiceProvider;
- use App\Expert\Providers\ExpertServiceProvider;
- use App\Form\Providers\FormServiceProvider;
- use App\Live\Providers\LiveServiceProvider;
- use App\Log\Providers\LogProvider;
- use App\Order\Providers\OrderServiceProvider;
- use App\RedisDeposit\Providers\RedisDepositServiceProvider;
- use App\Sys\Providers\SysServiceProvider;
- use App\TencentCloud\Providers\TencentServiceProvider;
- use App\User\Providers\UserServiceProvider;
- use App\Web\Providers\WebServiceProvider;
- use Illuminate\Redis\RedisServiceProvider;
- use Intervention\Image\ImageServiceProvider;
- use Laravel\Lumen\Providers\EventServiceProvider as ServiceProvider;
- class AppServiceProvider extends ServiceProvider
- {
- //路由文件名
- protected $routes = 'routes.php';
- public function boot()
- {
- //sql打印 不提交
- /* \DB::listen(function ($query) {
- $sql = array_reduce($query->bindings, function($sql, $binding) {
- return preg_replace('/\?/', is_numeric($binding) ? $binding : sprintf("'%s'", $binding), $sql, 1);
- }, $query->sql);
- \Log::info($sql);
- });*/
- //自动载入路由
- $func = new \ReflectionClass(get_class($this));
- $path = str_replace($func->getShortName() . '.php', '', $func->getFileName());
- $routesFile = $path . '../' . $this->routes;
- if (file_exists($routesFile)) {
- require $routesFile;
- }
- if (! isset($this->app['blade.compiler'])) {
- $this->app['view'];
- }
- parent::boot();
- }
- /**
- * 注册
- */
- public function register()
- {
- //基础服务
- $this->registerBaseService();
- //文档模块
- $this->app->register(DocServiceProvider::class);
- // 接口模块
- $this->app->register(ApiServiceProvider::class);
- //注册定时任务模块
- $this->app->register(TaskServiceProvider::class);
- $this->app->register(BasicServiceProvider::class);
- }
- // 注册基础服务
- public function registerBaseService()
- {
- // redis服务
- $this->app->register(RedisServiceProvider::class);
- // 短信服务
- // $this->app->register(AliyunsmsServiceProvider::class);
- // 授权验证
- $this->app->register(AuthServiceProvider::class);
- }
- }
|