Download the PHP package optimistdigital/nova-locale-field without Composer

On this page you can find all versions of the php package optimistdigital/nova-locale-field. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package nova-locale-field

Nova Locale Field

This package has been deprecated in favour of Nova Translatable

This Laravel Nova package allows you to manage multiple localisations of a model.

Screenshots

Installation

Install the package in a Laravel Nova project via Composer:

Usage

Preparing the models and database

This field requires a few database changes - namely, the model requires two new columns: one for the locale and one to reference the locale parent model.

You can set the column names to anything you want. The column names are passed to the field when creating it.

Column Suggested name Type (MySQL / Eloquent) Nullable Example value Description
Locale locale VARCHAR / string NO en_US A text column for the locale, maximum size depends on which types of locales you use (ie en vs en_US).
Locale parent ID locale_parent_id BIGINT / bigInteger YES 1 A locale parent reference column (foreign key, though the actual foreign key is optional)

Example migration:

Creating the field

This field has slightly different constructor (::make()) arguments than other Nova fields.

# Argument Type Description
1 \$name string Display name of the field, visible to the user as the column title in the index field and as the name of the locale selection field.
2 \$localeAttribute string The attribute (column) name of the locale value.
3 \$localeParentAttribute string The attribute (column) name for the locale parent id.

Options

Possible options you can pass to the field using the option name as a function, ie ->maxLocalesOnIndex(4).

Option Type Default Description
locales array [] Locales in an array as key-value pairs (['id' => 'value']).
maxLocalesOnIndex int 4 The amount of locales shown on the index view. If this is exceeded, the locales are only visible on the detail view.

Configuration

Config file

You can publish the config file and edit the default values (besides locales) there.

To publish the configuration file, run the following artisan publish command:

Default locales

The default locales can be defined in the config file via a closure or an array.

This default value can be overriden on a per-field basis using the ->locales([]) function directly on the field.

Filters

The package also provides a select type filter for the locales.

Using the locale filter

To use the locale filter, just add it to the array your resources' filters() function returns. Pass in the name of the locale field as the only argument in the constructor or the static make function.

You can also override the default displayed locale options by calling ->locales([]) on the filter. This is optional and the filter will use the default locales when not set.

Credits

License

This project is open-sourced software licensed under the MIT license.


All versions of nova-locale-field with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1.0
laravel/nova Version ^2.0.11 || ^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package optimistdigital/nova-locale-field contains the following files

Loading the files please wait ....