Skip to content

artem-alekseev/dictionaries

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Installing

Composer

How install package

composer require artem-alekseev/dictionaries:1.*

Usage

Make Dictionary

Use laravel artisan command

php artisan make:dictionary NameDictionary

In dictionary

class NameDictionary extends Dictionary
{
    const ONE = 1;
    const TWO = 2;
    
    public static function getDictionary(): array
    {
        return [
            self::ONE => 'One',
            self::TWO => 'Two',
        ];
    }
}

Use in code

echo NameDictionary::ONE; // out 1
echo NameDictionary::getValueData($this->id); // id = 2 // out 'Two'
echo NameDictionary::getRange(); // out [1,2] use in validation
echo NameDictionary::getStringRange(); // out '1,2' use in validation
echo NameDictionary::getDictionary() // out [1 => 'One', 2 => 'Two'] use in selector form field

License

This project is licensed under the MIT License - see the LICENSE.md file for details

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages