PHP code example of opscale-co / nova-catalogs

1. Go to this page and download the library: Download opscale-co/nova-catalogs 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/ */

    

opscale-co / nova-catalogs example snippets


use Opscale\NovaCatalogs\Concerns\Catalogable;

class Company extends Model
{
    use Catalogable;
}

use Opscale\NovaCatalogs\Models\Catalog;

// Get all options as key => name array
Catalog::options('countries');

// Filter options using a callback (e.g., by data)
Catalog::filteredOptions('countries', fn ($item) => $item->data['continent'] === 'europe');

Select::make('Country')
    ->options(Catalog::options('countries'))
    ->displayUsingLabels();