PHP code example of abnermouke / pros

1. Go to this page and download the library: Download abnermouke/pros library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

abnermouke / pros example snippets


Abnermouke\Pros\ProsServiceProvider::class,

public function register()
{
  if ($this->app->environment() !== 'production') {
      $this->app->register(\Abnermouke\Pros\ProsServiceProvider::class);
  }
  // ...
}

protected $middlewareGroups = [

        // 其他路由配置

        'abnermouke.pros.console' => [
            \App\Http\Middleware\EncryptCookies::class,
            \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
            \Illuminate\Session\Middleware\StartSession::class,
            // \Illuminate\Session\Middleware\AuthenticateSession::class,
            \Illuminate\View\Middleware\ShareErrorsFromSession::class,
            \App\Http\Middleware\VerifyCsrfToken::class,
            \Illuminate\Routing\Middleware\SubstituteBindings::class,
        ],


        'abnermouke.pros.console.auth' => [
            \App\Http\Middleware\Abnermouke\Pros\Console\ConsoleBaseMiddleware::class
        ],
    ];



    use Illuminate\Support\Facades\Route;
    use Illuminate\Support\Facades\Schema;


    public function register()
    {
    
        //其他配置
    
        //迁移配置
        Schema::defaultStringLength(191);
        //默认路由条件配置
        Route::pattern('page', '[0-9]+');
        Route::pattern('page_size', '[0-9]+');
        Route::pattern('id', '[0-9]+');
        Route::pattern('status', '[0-9]+');
        Route::pattern('parent_id', '[0-9]+');
        Route::pattern('order_sn', '[A-Z0-9]+');
    }



  public function map()
    {
        
        // 其他路由配置

        $this->mapAbnermoukeProConsoleRoutes();
    }

    /**
     * Define the "abnermouke/pros" console routes for the application.
     *
     * These routes are typically stateless.
     *
     * @return void
     */
    protected function mapAbnermoukeProConsoleRoutes()
    {
        Route::middleware('abnermouke.pros.console')
            ->namespace('App\Interfaces\Pros\Console\Controllers')
            ->group(base_path('routes/abnermouke/pros/console.php'));
    }

public function boot()
{
    $this->configureRateLimiting();
    
    $this->routes(function () {
    
         // 其他路由服务注册

        Route::middleware('abnermouke.pros.console')
            ->namespace('App\Interfaces\Pros\Console\Controllers')
            ->group(base_path('routes/abnermouke/pros/console.php'));
    });
}

    protected $except = [
        
        //其他例外
        
    
        'pros/console/uploader/*'
    ];

     "autoload": {
       
       // 
        
        "files": [
            
            //其他加载文件
            
            "app/Helpers/pros.php"
        ]
    },


    protected $commands = [
    
        //
        
        
        \App\Console\Commands\Pros\Tasks\TemporaryFileCommand::class,
        \App\Console\Commands\Pros\Tasks\QueryAmapAreaCommand::class,
    ];

  
    protected function schedule(Schedule $schedule)
    {
      
        //
        
        //每五分钟清除过期文件
        $schedule->command('temporary_file:clear')->everyFiveMinutes();
        //每五分钟查询高德最新地图信息
        $schedule->command('amap:query')->everyFiveMinutes();
    }


public function up()
    {

        //执行默认 Abnermouke 相关构建模块迁移
        $this->migrate('abnermouke', 'Abnermouke');

        //执行其他指定模块迁移
        $this->migrate('pros', 'Pros');

    }

shell
php artisan vendor:publish --provider="Abnermouke\Pros\ProsServiceProvider"
shell
composer dump-autoload
shell
php artisan builder:pros