Download the PHP package bitcodesa/nova-label without Composer
On this page you can find all versions of the php package bitcodesa/nova-label. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download bitcodesa/nova-label
More information about bitcodesa/nova-label
Files in bitcodesa/nova-label
Package nova-label
Short Description Create Labels for Nova Resources with different languages.
License MIT
Homepage https://github.com/abather/nova-label
Informations about the package nova-label
Create Labels for Nova Resources with different languages.
~~Dynamically Manage Labels for Nova Resources
This document details how to dynamically manage labels for Nova resources using the bitcodesa/nova-label
package.
Installation
Install the package using Composer:
Usage
- Include ResourceLabel:
In App/Nova/Resource.php
, extend the NovaResource
class and add the ResourceLabel
trait:
- Generate Labels:~~
Use the self::attribute()
method to generate field labels. This method handles both field name and database attribute:
Optional Parameters:
- Attribute name:
Specify a different database attribute name:
- Title only:
Return only the attribute title:
- Handle Relationships:
For relationship fields, pass the corresponding resource class as the first parameter to self::relation()
:
Relationship Label Customization:
Similar to field labels, you can customize relationship labels with title
and relation
parameters:
Change File Name:
you can change file name for any resource by override getLangPath()
function:
Change Resource Name:
you can change file name for any resource by override getLangName()
function:
Localization
File Structure
Each resource has a dedicated localization file for field and other translations. The file structure should follow:
Create Localization Files
To create a new localization file for a specific resource and language:
For example, to create an Arabic translation file for the Book
resource:
This command generates a file at Lang/ar/Book.php
. Translate each line in the file according to your needs.
Note: Run php artisan migrate
before creating the localization file to ensure all column names are available for
translation.
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- Abather M.S
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of nova-label with dependencies
laravel/framework Version ^10.0
spatie/laravel-package-tools Version ^1.14.0
illuminate/contracts Version ^10.0
laravel/nova Version ^4.0