wamesk/laravel-nova-country

Laravel Nova 4 Country field.

2.0.0 2024-05-03 09:34 UTC

This package is auto-updated.

Last update: 2024-05-03 09:35:29 UTC


README

Requirements

  • laravel/nova: ^4.0

Installation

composer require wamesk/laravel-nova-country
php artisan migrate
php artisan db:seed --class=LanguageSeeder

php artisan db:seed --class=CurrencySeeder

php artisan db:seed --class=CountrySeeder

Add Policy to ./app/Providers/AuthServiceProvider.php

protected $policies = [
    'App\Models\Country' => 'Policies\CountryPolicy',
];

Usage

Select::make(__('customer.field.country'), 'country_code')
    ->help(__('customer.field.country.help'))
    ->options(fn () => CountryController::getListForSelect())
    ->searchable()
    ->required()
    ->rules('required')
    ->onlyOnForms(),
                        
BelongsTo::make(__('customer.field.country'), 'country', Country::class)
    ->displayUsing(fn () => CountryController::displayUsing($request, $this))
    ->sortable()
    ->filterable()
    ->showOnPreview()
    ->exceptOnForms(),