wamesk / laravel-nova-language
Laravel Nova 4 Language field.
3.0.5
2024-09-04 08:40 UTC
Requires
- laravel/nova: ^4.0
- rinvex/languages: ^7.1
README
Requirements
laravel/nova: ^4.0
Installation
composer require wamesk/laravel-nova-language
php artisan migrate
php artisan db:seed --class=LanguageSeeder
Add Policy to ./app/Providers/AuthServiceProvider.php
protected $policies = [ 'App\Models\Language' => 'Wame\LaravelNovaLanguage\Policies\LanguagePolicy', ];
Usage
Select::make(__('laravel-nova-language::customer.field.language'), 'language_code') ->help(__('laravel-nova-language::customer.field.language.help')) ->options(fn () => LanguageController::getListForSelect()) ->searchable() ->required() ->rules('required') ->onlyOnForms(), BelongsTo::make(__('laravel-nova-language::customer.field.language'), 'language', Language::class) ->displayUsing(fn () => LanguageController::displayUsing($request, $this)) ->sortable() ->filterable() ->showOnPreview() ->exceptOnForms() ->hideFromIndex(),