PHP code example of medalink / laravel-reflects-constants

1. Go to this page and download the library: Download medalink/laravel-reflects-constants 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/ */

    

medalink / laravel-reflects-constants example snippets



class ProductInformation
{
    use \Medalink\Reflects\Constants;

    /**
    * Optional constant blacklist, anything in here will be filtered
    */
    public $reflectedConstantsBlacklist = [
        'TEST',
    ];

    const TYPE_OVERVIEW = 'OVERVIEW';
    const TYPE_SAFETY = 'SAFETY';
    const TYPE_WARRANTY = 'WARRANTY';
    const TYPE_PRODUCT_INFO = 'PRODUCT_INFO';
    const TEST = 'TEST';
}

$factory->define(ProductInformation::class, function (Faker $faker) {
    return [
        'type' => $faker->randomElement(ProductInformation::getReflectedConstants('TYPE_')),
    ];
});

$types = ProductInformation::getReflectedConstants('TYPE_');

$types = [
    'Overview',
    'Safety',
    'Warranty',
    'Product Info'
];

Select::make('Type')
    ->options(ProductInformation::getReflectedConstants('TYPE_'))
    ->sortable(),