Download the PHP package cactus-galaxy/filament-astrotomic without Composer

On this page you can find all versions of the php package cactus-galaxy/filament-astrotomic. 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 filament-astrotomic

Filament Astrotomic Translations

Latest Version on Packagist Total Downloads

This package is an extension for Filament and laravel-translatable.

Inspired by spatie/laravel-translatable, another alternative for the translation package for your Laravel application.

See more configuration examples of the Filament panel in GalaxyStore - demo project with Filament, Astrotomic package and more.

Installation

You can install the package via Composer:

Publish configs for astrotomic/laravel-translatable package:

After this, you will have to configure the locales your app should use.

Adding the plugin to a panel

To add a plugin to a panel, you must include it in the configuration file using the plugins() method:

Preparing your model class

You need to make your model translatable. You can read how to do this in documentation for Laravel translatable.

Preparing your resource class

You must apply the ResourceTranslatable trait to your resource class:

Making resource pages translatable

After preparing your resource class, you must make each of your resource's pages translatable too. You can find your resource's pages in the Pages directory of each resource folder. To prepare a page, you must apply the corresponding {Type}Translatable trait to it:

And if you have a ViewRecord page for your resource:

Setting the translatable locales for a particular resource

By default, the translatable locales loaded using Astrotomic's Locales helper from method all() which returns all locales from the translatable.locales configuration. Alternatively, you can customize the translatable locales for a particular resource by overriding the getTranslatableLocales() method in your resource class:

Using locale tabs on the form

TranslatableTabs extends the default Filament\Forms\Components\Tabs component and provides a way to create tab schema tabs for each locale. Within the localeTabSchema method, you can define the schema for each tab.

You can use it in your form like this:

With this code, you will get tabs for each locale with name field in each tab. name field will be required only for the main locale. Also, it will generate a slug for the item based on the main locale.

By default $tab->makeName('name') uses array syntax for naming -{$locale}.{$name}, but you can change it by calling makeNameUsing on TranslatableTabs, for example, use plain syntax:

Processing modal forms with translations

If you want to use translations in modal forms, you need to make some changes, to correctly mutate and fill your form.

Edit table action

For example, we have ProductResource but don't have an edit page.

To process translations in the Edit action modal, you need to override the mutateRecordDataUsing method of the EditAction class in the resource class.

And if you are using a Column with path translation.*, make sure to unset the translation relation from the record data before returning it, otherwise, the record data will be saved incorrectly.

Select with modal options

There is a more complex example with Select component. For example, we need to manage (create or edit) a category for the product.

In the CategoryResource defined form with translatable fields.

Then is ProductResource we can use Select component with modal options. Note that we need to call the fillEditOptionActionFormUsing method and mutate record data

Columns for translatable models on listings

Out of the box, Filament supports nesting for columns, which means you can use . in the column path to access nested properties, and you don't need a special column for translatable models.

But searching by translatable column is more complicated to write for each text column. To solve and to add an option to search by column, we recommend adding the following lines to configure your column to your ServiceProvider in boot method.

From FilamentServiceProvider of GalaxyStore

Maybe in the feature someone will create a column for that 🙂, but currently you can use this code to configure your columns.

Testing

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

As quick example, you can clone GalaxyStore and this package to one folder

Add repositories section to your GalaxyStore/composer.json file

Then execute composer

or manually add package to composer.json file

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of filament-astrotomic with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
astrotomic/laravel-translatable Version ^11.12
filament/filament Version ^3.0
laravel/framework Version ^10.0 || ^11.0
spatie/laravel-package-tools Version ^1.15.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 cactus-galaxy/filament-astrotomic contains the following files

Loading the files please wait ....