PHP code example of madbox-99 / filament-translatable-model-labels

1. Go to this page and download the library: Download madbox-99/filament-translatable-model-labels 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/ */

    

madbox-99 / filament-translatable-model-labels example snippets


use Filament\Resources\Resource;
use MadBox99\FilamentTranslatableModelLabels\Concerns\TranslatesFilamentModelLabels;

abstract class BaseResource extends Resource
{
    use TranslatesFilamentModelLabels;
}

use MadBox99\FilamentTranslatableModelLabels\TranslatableFilamentResource;

class IssueResource extends TranslatableFilamentResource
{
    protected static ?string $model = \App\Models\Issue::class;
}

class OrderResource extends Resource
{
    use TranslatesFilamentModelLabels;

    protected static ?string $model = Order::class;
    // ...
}

// config/filament-translatable-model-labels.php
return [
    'inject_trait_into_generated_resources' => false,
];

use MadBox99\FilamentTranslatableModelLabels\Rector\AddTranslatesFilamentModelLabelsTraitRector;
use Rector\Config\RectorConfig;

return RectorConfig::configure()
    ->withPaths([__DIR__ . '/app'])
    ->withImportNames()
    ->withRules([
        AddTranslatesFilamentModelLabelsTraitRector::class,
    ]);