PHP code example of avto-dev / static-references-laravel

1. Go to this page and download the library: Download avto-dev/static-references-laravel 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/ */

    

avto-dev / static-references-laravel example snippets




namespace App\Console\Commands;

use AvtoDev\StaticReferences\References\SubjectCodes;
use AvtoDev\StaticReferences\References\VehicleCategories;

class SomeCommand extends \Illuminate\Console\Command
{
    /**
     * The console command name.
     *
     * @var string
     */
    protected $name = 'some:command';

    /**
     * Execute the console command.
     *
     * @param SubjectCodes      $subject_codes
     * @param VehicleCategories $vehicle_categories
     *
     * @return void
     */
    public function handle(SubjectCodes $subject_codes, VehicleCategories $vehicle_categories): void
    {
        // Print all vehicle categories in a one string
        $this->info(collect($vehicle_categories)->pluck('code')->implode(', ')); // A, A1, B, BE...

        // Get all GIBDD codes for moscow subject
        $this->info($subject_codes->getByGibddCode(77)->getGibddCodes()); // [77, 97, 99, 177, ...]

        // Make GIBDD codes validation
        $subject_codes->hasGibddCode(777); // true
        $subject_codes->hasGibddCode(666); // false
    }
}