PHP code example of optimistdigital / nova-locale-field
1. Go to this page and download the library: Download optimistdigital/nova-locale-field 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/ */
optimistdigital / nova-locale-field example snippets
Schema::table('some_model_table', function ($table) {
$table->string('locale');
$table->bigInteger('locale_parent_id')->nullable();
// Optionally, add a foreign key
$table->foreign('locale_parent_id')->references('id')->on('some_model_table');
});
use OptimistDigital\NovaLocaleField\LocaleField;
LocaleField::make('Locale', 'locale', 'locale_parent_id')
->locales(['en' => 'English', 'et' => 'Estonian']) // Optional when you've set a default
->maxLocalesOnIndex(4) // Optional, defaults to 4
use \OptimistDigital\NovaLocaleField\Filters\LocaleFilter;
public function filters(Request $request)
{
return [
LocaleFilter::make('locale')
->locales(NovaEcommerce::getLocales()), // <- Optional
// OR
new LocaleFilter('locale'),
];
}