Download the PHP package eightynine/filament-excel-import without Composer
On this page you can find all versions of the php package eightynine/filament-excel-import. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download eightynine/filament-excel-import
More information about eightynine/filament-excel-import
Files in eightynine/filament-excel-import
Package filament-excel-import
Short Description Import Excel files with Laravel Filament.
License MIT
Homepage https://github.com/eightynine/filament-excel-import
Informations about the package filament-excel-import
Filament Excel Import
This package adds a new feature to your filament resource, allowing you to easily import data to your model
This package brings the maatwebsite/laravel-excel functionalities to filament. You can use all the maatwebsite/laravel-excel features in your laravel project
🛠️ Be Part of the Journey
Hi, I'm Eighty Nine. I created excel import plugin to solve real problems I faced as a developer. Your sponsorship will allow me to dedicate more time to enhancing these tools and helping more people. Become a sponsor and join me in making a positive impact on the developer community.
Installation
You can install the package via composer:
Usage
Before using this action, make sure to allow Mass Assignment for your model. If you are doing a custom import, this is not necessary.
For example, if you have a 'ClientResource' in your project, integrate the action into ListClients class as demonstrated below:
Customise Import Process
Using a closure
You can use a closure to process the collection after it has been imported.
Using your own Import class
If you wish to use your own import class to change the import procedure, you can create your own Import class.
Then in your action use your client import class
Form Customisation
You can customise the form by using the beforeUploadField
and afterUploadField
methods. These methods accept an array of fields that will be added to the form before and after the upload field. You can also use the uploadField
method to customise the upload field.
Custom Upload Disk
To use a custom upload disk, you can publish the config file and customise the upload_disk config.
Then in your config file, you can customise the upload_disk config.
Performing Actions Before and After Import
You can perform actions before and after import by using the beforeImport and afterImport closures.
$data
is the data that is submitted via the form, meaning the file upload is also available in $data['upload']
, and $livewire
is the Livewire instance that the action is being performed on (in this case, the ListClients class).
Data Validation
You can validate the data before importing by using the validateUsing
method. This method accepts an array of rules that will be used to validate the data. You can use all the rules from the Laravel validation system.
Mutating data before and after validation
In some cases you may want to mutate the data before or after validation, in order to achieve this, you can use mutateBeforeValidationUsing
and mutateAfterValidationUsing
functions methods.
Sample Excel File
You can allow users to download a sample excel file by using the sampleExcel
method. This method accepts an array of data, a file name, an export class and a sample button label.
Using import action to import relationships
The import action can also be used to import relationships. This is done by using the DefaultRelationshipImport
class in your relation manager.
Everything behaves and can be modified similar to the ExcelImportAction
class, except the DefaultRelationshipImport
class is used instead of the DefaultImport
class. So if you are implementing a custom import class, you will need to extend the DefaultRelationshipImport
class instead of the DefaultImport
class.
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
- Eighty Nine
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of filament-excel-import with dependencies
filament/filament Version ^3.0
illuminate/contracts Version ^10.0|^11.0
maatwebsite/excel Version ^3.1
spatie/laravel-package-tools Version ^1.15.0