PHP code example of acacha / periods

1. Go to this page and download the library: Download acacha/periods 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/ */

    

acacha / periods example snippets


...
 /*
         * Package Service Providers...
         */
        Acacha\Periods\Providers\PeriodsServiceProvider::class,
...

php artisan vendor:publish --tag=acacha_periods



return [

    /*
    |--------------------------------------------------------------------------
    | Session variable name for periods
    |--------------------------------------------------------------------------
    |
    | This value is the name of the session vairable that storages desired period.
    */

    'session_variable' => 'ACACHA_PERIOD',

    /*
    |--------------------------------------------------------------------------
    | Valid period values and related database connections
    |--------------------------------------------------------------------------
    |
    | This value is an array that stores valid period values and his related
    | database connections.
    */

    'periods' => [
        '2016-17' => env('DB_CONNECTION', 'mysql'),
        '2015-16' => env('DB_CONNECTION', 'mysql') . '_1516',
        '2014-15' => env('DB_CONNECTION', 'mysql') . '_1415',
    ],

];

...
    'connections' => [

        'sqlite' => [
            'driver' => 'sqlite',
            'database' => env('DB_DATABASE', database_path('database.sqlite')),
            'prefix' => '',
        ],

        'sqlite_1516' => [
            'driver' => 'sqlite',
            'database' => env('DB_DATABASE', database_path('database1516.sqlite')),
            'prefix' => '',
        ],

        'sqlite_1415' => [
            'driver' => 'sqlite',
            'database' => env('DB_DATABASE', database_path('database1415.sqlite')),
            'prefix' => '',
        ],
...
 php
...
 protected $middlewareGroups = [
        'web' => [
            ...
            \Acacha\Periods\Middleware\Periods::class
        ],
...