|
| 1 | +[](https://TheBSD.github.io/StandWithPalestine/) |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | +# Filament Excel |
| 6 | + |
| 7 | +The easiest way to work with "Excel", you only need to get fimiliar with [Laravel Excel](https://github.com/SpartnerNL/Laravel-Excel) to supercharged Excel exports and imports on your filament projects. |
| 8 | + |
| 9 | + |
| 10 | +## Installation |
| 11 | + |
| 12 | +You can install the package via Composer: |
| 13 | + |
| 14 | +```bash |
| 15 | +composer require yemenopensource/filament-excel |
| 16 | +``` |
| 17 | + |
| 18 | +## Usage |
| 19 | +Create [Create a new Import](https://docs.laravel-excel.com/3.1/imports/) for your model for example 'Content' model. |
| 20 | + |
| 21 | +```php |
| 22 | +php artisan make:import ContentsImport --model=Content |
| 23 | +``` |
| 24 | + |
| 25 | +Use the `Import` action on your filament resouce list page for example 'ListContents' page is a page to list the records of 'ContentResource': |
| 26 | + |
| 27 | +```php |
| 28 | +// app\Filament\Resources\ContentResource\Pages\ListContents.php |
| 29 | + |
| 30 | +use YOS\FilamentExcel\Actions\Import; |
| 31 | + |
| 32 | +protected function getHeaderActions(): array |
| 33 | +{ |
| 34 | + return [ |
| 35 | + // ... other actions like 'CreateAction' |
| 36 | + Import::make() |
| 37 | + ->import(ContentsImport::class) |
| 38 | + ->type(\Maatwebsite\Excel\Excel::XLSX) |
| 39 | + ->label('Import from excel') |
| 40 | + ->hint('Upload xlsx type') |
| 41 | + ->icon(HeroIcons::C_ARROW_UP) |
| 42 | + ->color('success'), |
| 43 | + ]; |
| 44 | +} |
| 45 | +``` |
| 46 | + |
| 47 | +## Configuration |
| 48 | + |
| 49 | +The package provides a configuration file that allows you to customize its behavior. |
| 50 | + |
| 51 | +You can publish the configuration file by using the following command: |
| 52 | + |
| 53 | +```bash |
| 54 | +php artisan vendor:publish --provider="YOS\FilamentExcel\ServiceProvider" --tag="config" |
| 55 | +``` |
| 56 | + |
| 57 | +After publishing the configuration file, you can find it at config/filamentExcel.php. Open this file and modify it according to your requirements. |
| 58 | + |
| 59 | +## Translations |
| 60 | + |
| 61 | +You can publish translations using: |
| 62 | + |
| 63 | +```bash |
| 64 | +php artisan vendor:publish --provider="YOS\FilamentExcel\ServiceProvider" --tag="config" |
| 65 | +``` |
| 66 | + |
| 67 | +When users of the package execute Laravel's `vendor:publish` Artisan command, the package's language files will be published to `language path/vendor/filament-excel`. |
| 68 | +## Contributing |
| 69 | + |
| 70 | +Contributions are welcome! If you find any issues or have suggestions for improvements, please feel free to create an issue or a pull request. |
| 71 | + |
| 72 | +## License |
| 73 | + |
| 74 | +The package is part of yemen open source and it is licensed under the MIT license. |
| 75 | + |
| 76 | +## Credits |
| 77 | + |
| 78 | +- [Muath Alsowadi](https://github.com/muath-ye) |
0 commit comments