Subiendo proyecto completo sin restricciones de git ignore
This commit is contained in:
20
vendor/maatwebsite/excel/.styleci.yml
vendored
Normal file
20
vendor/maatwebsite/excel/.styleci.yml
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
preset: laravel
|
||||
|
||||
risky: false
|
||||
|
||||
enabled:
|
||||
- align_double_arrow
|
||||
- align_equals
|
||||
- concat_with_spaces
|
||||
- ordered_class_elements
|
||||
|
||||
disabled:
|
||||
- concat_without_spaces
|
||||
- not_operator_with_successor_space
|
||||
- unalign_equals
|
||||
|
||||
finder:
|
||||
not-name:
|
||||
- "*.md"
|
||||
not-path:
|
||||
- ".github"
|
||||
308
vendor/maatwebsite/excel/CHANGELOG.md
vendored
Normal file
308
vendor/maatwebsite/excel/CHANGELOG.md
vendored
Normal file
@@ -0,0 +1,308 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [3.1.47] - 2023-02-16
|
||||
|
||||
- Support Laravel 10
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fix Bug Multiple drawings change the behavior of the startCell (#3865).
|
||||
- Allow configuring read data only in chunks as well.
|
||||
|
||||
## [3.1.46] - 2023-01-27
|
||||
|
||||
- Support Laravel 10
|
||||
|
||||
## [3.1.45] - 2023-01-02
|
||||
|
||||
### Added
|
||||
- Add support for ignoring PHP auto_detect_line_endings INI directive
|
||||
|
||||
### Fixed
|
||||
- Fix the PSR simple cache dependency mess to maintain backwards compatability and support 3.0 of the interface.
|
||||
|
||||
## [3.1.44] - 2022-10-14
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fix output of `WithFormatData` in combination with `SkipsEmptyRows` (#3760)
|
||||
|
||||
### Changed
|
||||
|
||||
- Cast empty headings to indexed integer (#3646)
|
||||
- Adds `isEmptyWhen` to customize is row empty logic. (#3645)
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fix temporary local files not being cleaned up when setting force_resync_remote config to true (#3623)
|
||||
- Fix testing for multiple stored files by regex matching (#3631).
|
||||
- Allow `required_unless` rule (#3660)
|
||||
|
||||
## [3.1.40] - 2022-05-02
|
||||
|
||||
- Fix testing for multiple stored files by regex matching (#3631).
|
||||
|
||||
### Changed
|
||||
|
||||
- Adds `WithDefaultStyles` concern to allow configuring the workbook default styles.
|
||||
- Adds `WithBackgroundColor` concern to allow configuring the workbook default background color.
|
||||
- Expose the ability to set custom response headers when exporting collections via Exportable
|
||||
|
||||
## [3.1.39] - 2022-04-23
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fix PHP8.1 return type for Failure class (#3588)
|
||||
|
||||
## [3.1.38] - 2022-03-24
|
||||
|
||||
### Changed
|
||||
|
||||
- Adds concern `WithGroupedHeadingRow` to allow imported sheets to group the values of columns with the same header in an array
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fix for `prepareForValidation` callback not being called when using `SkipsEmptyRows`
|
||||
|
||||
## [3.1.37] - 2022-02-28
|
||||
|
||||
### Fixed
|
||||
|
||||
- Add `@mixin` docblock to all macroable classes to allow for IDE autocompletion of delegate classes
|
||||
- Fix issue with `Excel::toArray` not allowing nullable reader types for uploaded files
|
||||
|
||||
### Changed
|
||||
|
||||
- Change default Csv Import to auto-detect the delimiter when not explicitly defined
|
||||
|
||||
## [3.1.36] - 2022-02-03
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fix return type of `FromQuery::query()`
|
||||
|
||||
### Changed
|
||||
|
||||
- Support Laravel 9
|
||||
- Added a config setting to specify DB connection
|
||||
- Added a config setting to specify CSV output encoding
|
||||
- Added an ability to specify CSV ouput encoding through csvSettings
|
||||
|
||||
## [3.1.35] - 2022-01-04
|
||||
|
||||
### Fixed
|
||||
|
||||
- Removed cache flush for cell caching as this is already handled by PhpSpreadsheet
|
||||
- Fix `SkipsEmptyRows` support with the `WithColumnLimit` concern
|
||||
- Added range support to FormatColumn
|
||||
|
||||
## [3.1.34] - 2021-12-2
|
||||
|
||||
### Changed
|
||||
|
||||
- Change default local_path configuration
|
||||
- Fix queueImport function to be able to assert chained jobs
|
||||
- Skipped failure no longer persists in `ToCollection` and `ToArray`.
|
||||
- Fix missing InteractsWithQueue trait in AppendToSheet jobs
|
||||
- Add return types to `Row`'s `ArrayAccess` implementation
|
||||
|
||||
## [3.1.33] - 2021-08-12
|
||||
|
||||
### Fixed
|
||||
|
||||
- Make TransactionManager a singleton (#3270)
|
||||
- Fix Exportable disk options (#3296)
|
||||
- Delete temporary file after exception in import class (#3312)
|
||||
|
||||
## [3.1.32] - 2021-07-08
|
||||
|
||||
### Added
|
||||
|
||||
- Add assertExportedInRaw assertion (#3255)
|
||||
|
||||
### Fixed
|
||||
|
||||
- Make commands detect model directory now (#3213)
|
||||
|
||||
## [3.1.31] - 2021-06-02
|
||||
|
||||
### Added
|
||||
|
||||
- Custom heading row formatter can use column index (#3166)
|
||||
- Added WithFormatData concern (#3154)
|
||||
|
||||
### Fixed
|
||||
|
||||
- Create failures of rows than didn't exists but where requested in row
|
||||
validation
|
||||
- Fix Bug Formulas are not calculated when import implements
|
||||
WithCalculatedFormulas with SkipsEmptyRows #3127
|
||||
- PhpSpreadsheet 1.18 support
|
||||
|
||||
## [3.1.30] - 2021-04-06
|
||||
|
||||
### Added
|
||||
|
||||
- Octane compatibility
|
||||
|
||||
## [3.1.29] - 2021-03-16
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fix AfterImport Event not being called (#3085)
|
||||
|
||||
## [3.1.28] - 2021-03-10
|
||||
|
||||
### Added
|
||||
|
||||
- Added WithUpsertColumns concern (#3046)
|
||||
- Added ShouldQueueWithoutChain concern (#3072)
|
||||
|
||||
### Fixed
|
||||
|
||||
- Limit Phpspreadsheet version to 1.16 until bugfix release
|
||||
- Fixed issue with not autosizing columns (#3055)
|
||||
- Fix selecting worksheets by name with chunk reading (#3052)
|
||||
|
||||
## [3.1.27] - 2021-02-22
|
||||
|
||||
### Added
|
||||
|
||||
- Added SkipsEmptyRows concern
|
||||
- Added HasReferencesToOtherSheets concern to allow import of calculated
|
||||
|
||||
### Changed
|
||||
|
||||
- Bump minimum PhpSpreadsheet version
|
||||
- Progressbar NullOutput as fallback
|
||||
|
||||
## [3.1.26] - 2020-11-13
|
||||
|
||||
### Added
|
||||
|
||||
- PHP 8 support
|
||||
|
||||
## [3.1.25] - 2020-11-13
|
||||
|
||||
### Added
|
||||
|
||||
- Added an ability to prepare rows before appending rows to sheet. Just add
|
||||
`prepareRows` method for your export class if needed.
|
||||
- Added an ability to catch exceptions from `QueueExport` job. Just add `failed`
|
||||
method for your export class if needed.
|
||||
- Added an ability to set locale for queued export. Just implement
|
||||
`Illuminate\Contracts\Translation\HasLocalePreference` for your export.
|
||||
- Added `JsonSerializable` support in `Maatwebsite\Excel\Validators\Failure`.
|
||||
- Added `$maxExceptions` support in `Maatwebsite\Excel\Jobs\ReadChunk.php`.
|
||||
- Added support to upsert models by implementing the `WithUpserts` concern.
|
||||
|
||||
## [3.1.24] - 2020-10-28
|
||||
|
||||
### Added
|
||||
|
||||
- Added support for `prepareForValidation` on `WithValidation` concern
|
||||
- Added support for `withValidator` on `WithValidation` concern
|
||||
- Added `ArrayAccess` to `Row`
|
||||
|
||||
### Fixed
|
||||
|
||||
- Corrected SkipsErrors doc block
|
||||
|
||||
## [3.1.23] - 2020-09-29
|
||||
|
||||
### Added
|
||||
|
||||
- Added `ignore_empty` setting to `config/excel.php`
|
||||
- Added `strict_null_comparison` setting to `config/excel.php`
|
||||
|
||||
## [3.1.22] - 2020-09-08
|
||||
|
||||
- Laravel 8 support
|
||||
- Lumen improvements
|
||||
|
||||
## [3.1.21] - 2020-08-06
|
||||
|
||||
### Added
|
||||
|
||||
- Added WithProperties concern
|
||||
- Added default spreadsheet properties config
|
||||
- Added WithColumnWidths concern
|
||||
- Added WithStyles concern.
|
||||
- Config setting to configure cell caching
|
||||
|
||||
### Changed
|
||||
|
||||
- Sheet titles longer than 31 chars get trimmed.
|
||||
- Sheet titles with unsupported chars get cleaned.
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed issue with using ShouldAutosize in combination with FromView column
|
||||
widths.
|
||||
|
||||
## [3.1.20] - 2020-07-22
|
||||
|
||||
### Added
|
||||
|
||||
- Re-sycing remote temporary file
|
||||
- Remember row number
|
||||
- Remember chunk offset
|
||||
- WithColumnLimit concern
|
||||
- WithReadFilter concern
|
||||
- Publishing the stubs
|
||||
|
||||
### Changed
|
||||
|
||||
- Interacting with queued jobs
|
||||
- Retry until and middleware on queued imports
|
||||
- Using WithValidation with FromCollection & FromArray
|
||||
- Read filters for WithLimit and HeadingRowImport
|
||||
- Bump of minimum version PhpSpreadsheet
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed test helper docblocks on the Excel facade.
|
||||
- Fix for importing with a start row beyond the highest row.
|
||||
- Fixed `BeforeSheet` and `AfterSheet` events receiving exportable instance
|
||||
instead of importable when calling on an Import.
|
||||
- Fix for value binders not working in queued exports.
|
||||
- Fix when using WithLimit concern when having less rows than the limit.
|
||||
- Fix AfterImport job being fired twice if not using queueing.
|
||||
- Raw() method now also available on Exportable.
|
||||
- Fix for breaking changes in PhpSpreadsheet with empty enclosures.
|
||||
|
||||
[Unreleased]: https://github.com/Maatwebsite/Laravel-Excel/compare/3.1.47...HEAD
|
||||
[3.1.47]: https://github.com/Maatwebsite/Laravel-Excel/compare/3.1.46...3.1.47
|
||||
[3.1.46]: https://github.com/Maatwebsite/Laravel-Excel/compare/3.1.45...3.1.46
|
||||
[3.1.45]: https://github.com/Maatwebsite/Laravel-Excel/compare/3.1.44...3.1.45
|
||||
[3.1.44]: https://github.com/Maatwebsite/Laravel-Excel/compare/3.1.43...3.1.44
|
||||
[3.1.43]: https://github.com/Maatwebsite/Laravel-Excel/compare/3.1.42...3.1.43
|
||||
[3.1.42]: https://github.com/Maatwebsite/Laravel-Excel/compare/3.1.41...3.1.42
|
||||
[3.1.41]: https://github.com/Maatwebsite/Laravel-Excel/compare/3.1.40...3.1.41
|
||||
[3.1.40]: https://github.com/Maatwebsite/Laravel-Excel/compare/3.1.39...3.1.40
|
||||
[3.1.39]: https://github.com/Maatwebsite/Laravel-Excel/compare/3.1.38...3.1.39
|
||||
[3.1.38]: https://github.com/Maatwebsite/Laravel-Excel/compare/3.1.37...3.1.38
|
||||
[3.1.37]: https://github.com/Maatwebsite/Laravel-Excel/compare/3.1.36...3.1.37
|
||||
[3.1.36]: https://github.com/Maatwebsite/Laravel-Excel/compare/3.1.35...3.1.36
|
||||
[3.1.35]: https://github.com/Maatwebsite/Laravel-Excel/compare/3.1.34...3.1.35
|
||||
[3.1.34]: https://github.com/Maatwebsite/Laravel-Excel/compare/3.1.33...3.1.34
|
||||
[3.1.33]: https://github.com/Maatwebsite/Laravel-Excel/compare/3.1.32...3.1.33
|
||||
[3.1.32]: https://github.com/Maatwebsite/Laravel-Excel/compare/3.1.31...3.1.32
|
||||
[3.1.31]: https://github.com/Maatwebsite/Laravel-Excel/compare/3.1.30...3.1.31
|
||||
[3.1.30]: https://github.com/Maatwebsite/Laravel-Excel/compare/3.1.29...3.1.30
|
||||
[3.1.29]: https://github.com/Maatwebsite/Laravel-Excel/compare/3.1.28...3.1.29
|
||||
[3.1.28]: https://github.com/Maatwebsite/Laravel-Excel/compare/3.1.27...3.1.28
|
||||
[3.1.27]: https://github.com/Maatwebsite/Laravel-Excel/compare/3.1.26...3.1.27
|
||||
[3.1.26]: https://github.com/Maatwebsite/Laravel-Excel/compare/3.1.25...3.1.26
|
||||
[3.1.25]: https://github.com/Maatwebsite/Laravel-Excel/compare/3.1.24...3.1.25
|
||||
[3.1.24]: https://github.com/Maatwebsite/Laravel-Excel/compare/3.1.23...3.1.24
|
||||
[3.1.23]: https://github.com/Maatwebsite/Laravel-Excel/compare/3.1.22...3.1.23
|
||||
[3.1.22]: https://github.com/Maatwebsite/Laravel-Excel/compare/3.1.21...3.1.22
|
||||
[3.1.21]: https://github.com/Maatwebsite/Laravel-Excel/compare/3.1.20...3.1.21
|
||||
[3.1.20]: https://github.com/Maatwebsite/Laravel-Excel/compare/3.1.19...3.1.20
|
||||
|
||||
_Older release notes can be found in Github releases._
|
||||
46
vendor/maatwebsite/excel/CODE_OF_CONDUCT.md
vendored
Normal file
46
vendor/maatwebsite/excel/CODE_OF_CONDUCT.md
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment include:
|
||||
|
||||
* Using welcoming and inclusive language
|
||||
* Being respectful of differing viewpoints and experiences
|
||||
* Gracefully accepting constructive criticism
|
||||
* Focusing on what is best for the community
|
||||
* Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or advances
|
||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic address, without explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a professional setting
|
||||
|
||||
## Our Responsibilities
|
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at patrick@spartner.nl. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
|
||||
|
||||
[homepage]: http://contributor-covenant.org
|
||||
[version]: http://contributor-covenant.org/version/1/4/
|
||||
3
vendor/maatwebsite/excel/CONTRIBUTING.md
vendored
Normal file
3
vendor/maatwebsite/excel/CONTRIBUTING.md
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# Contributing
|
||||
|
||||
Find the contributing guide at: https://docs.laravel-excel.com/3.1/getting-started/contributing.html
|
||||
21
vendor/maatwebsite/excel/LICENSE
vendored
Normal file
21
vendor/maatwebsite/excel/LICENSE
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Spartner
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
105
vendor/maatwebsite/excel/README.md
vendored
Normal file
105
vendor/maatwebsite/excel/README.md
vendored
Normal file
@@ -0,0 +1,105 @@
|
||||
<br />
|
||||
<br />
|
||||
<p align="center">
|
||||
<!-- XMAS: https://user-images.githubusercontent.com/7728097/146406114-a5f5e13a-e2ee-47a2-9bf9-ad43cdbdf200.png-->
|
||||
<img width="589" src="https://user-images.githubusercontent.com/7728097/143205384-af3c73a8-0253-45f3-b5ac-28a335dddb87.png" alt="Laravel Excel logo">
|
||||
</p>
|
||||
<br />
|
||||
|
||||
|
||||
<h3 align="center">Supercharged Excel exports and imports</h3>
|
||||
|
||||
<p align="center">
|
||||
A simple, but elegant <a href="https://laravel.com" target="_blank">Laravel<a/> wrapper around <a href="https://phpspreadsheet.readthedocs.io/" target="_blank">PhpSpreadsheet</a>
|
||||
exports and imports.
|
||||
</p>
|
||||
|
||||
<h4 align="center">
|
||||
<a href="https://docs.laravel-excel.com/3.1/exports/">Quickstart</a>
|
||||
<span> · </span>
|
||||
<a href="https://docs.laravel-excel.com/3.1/getting-started/">Documentation</a>
|
||||
<span> · </span>
|
||||
<a href="https://course.laravel-excel.com">Video Course</a>
|
||||
<span> · </span>
|
||||
<a href="https://github.com/SpartnerNL/Laravel-Nova-Excel">Nova</a>
|
||||
<span> · </span>
|
||||
<a href="https://medium.com/maatwebsite/laravel-excel/home">Blog</a>
|
||||
<span> · </span>
|
||||
<a href="https://docs.laravel-excel.com/3.1/getting-started/contributing.html">Contributing</a>
|
||||
<span> · </span>
|
||||
<a href="https://docs.laravel-excel.com/3.1/getting-started/support.html">Support</a>
|
||||
</h4>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://github.com/SpartnerNL/Laravel-Excel/actions">
|
||||
<img src="https://github.com/Maatwebsite/Laravel-Excel/workflows/Run%20tests/badge.svg?branch=3.1" alt="Github Actions">
|
||||
</a>
|
||||
|
||||
<a href="https://styleci.io/repos/14259390">
|
||||
<img src="https://styleci.io/repos/14259390/shield?branch=3.1" alt="StyleCI">
|
||||
</a>
|
||||
|
||||
<a href="https://packagist.org/packages/maatwebsite/excel">
|
||||
<img src="https://poser.pugx.org/maatwebsite/excel/v/stable.png" alt="Latest Stable Version">
|
||||
</a>
|
||||
|
||||
<a href="https://packagist.org/packages/maatwebsite/excel">
|
||||
<img src="https://poser.pugx.org/maatwebsite/excel/downloads.png" alt="Total Downloads">
|
||||
</a>
|
||||
|
||||
<a href="https://packagist.org/packages/maatwebsite/excel">
|
||||
<img src="https://poser.pugx.org/maatwebsite/excel/license.png" alt="License">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
## ✨ Features
|
||||
|
||||
- **Easily export collections to Excel.** Supercharge your Laravel collections and export them directly to an Excel or CSV document. Exporting has never been so easy.
|
||||
|
||||
- **Supercharged exports.** Export queries with automatic chunking for better performance. You provide us the query, we handle the performance. Exporting even larger datasets? No worries, Laravel Excel has your back. You can queue your exports so all of this happens in the background.
|
||||
|
||||
- **Supercharged imports.** Import workbooks and worksheets to Eloquent models with chunk reading and batch inserts! Have large files? You can queue every chunk of a file! Your entire import will happen in the background.
|
||||
|
||||
- **Export Blade views.** Want to have a custom layout in your spreadsheet? Use a HTML table in a Blade view and export that to Excel.
|
||||
|
||||

|
||||
<br>
|
||||
|
||||
## 🎓 Learning Laravel Excel
|
||||
|
||||
You can find the full documentation of Laravel Excel [on the website](https://docs.laravel-excel.com).
|
||||
|
||||
We welcome suggestions for improving our docs. The documentation repository can be found at [https://github.com/SpartnerNL/laravel-excel-docs](https://github.com/SpartnerNL/laravel-excel-docs).
|
||||
|
||||
Some articles and tutorials can be found on our blog: https://medium.com/maatwebsite/laravel-excel/home
|
||||
|
||||
## :mailbox_with_mail: License & Postcardware
|
||||
|
||||

|
||||
|
||||
Laravel Excel is created with love and care by Spartner (formerly known as Maatwebsite) to give back to the Laravel community. It is completely free (MIT license) to use, however the package is licensed as Postcardware. This means that if it makes it to your production environment, we would very much appreciate receiving a postcard from your hometown.
|
||||
|
||||
**Spartner**
|
||||
Markt 2
|
||||
6231 LS Meerssen
|
||||
The Netherlands.
|
||||
|
||||
More about the license can be found at: [https://docs.laravel-excel.com/3.1/getting-started/license.html](https://docs.laravel-excel.com/3.1/getting-started/license.html)
|
||||
|
||||
## Created by Spartner (formerly Maatwebsite)
|
||||
|
||||
We are a strategic development partner, creating web-based custom built software from Laravel. In need of a digital solution for your challenge? Give us a call.
|
||||
|
||||
https://spartner.software
|
||||
info@spartner.nl
|
||||
+31 (0) 10 - 7449312
|
||||
|
||||
## :wrench: Supported Versions
|
||||
|
||||
Versions will be supported for a limited amount of time.
|
||||
|
||||
| Version | Laravel Version | Php Version | Support |
|
||||
|---- |----|----|----|
|
||||
| 2.1 | <=5.6 | <=7.0 | Unsupported since 15-5-2018 |
|
||||
| 3.0 | ^5.5 | ^7.0 | Unsupported since 31-12-2018 |
|
||||
| 3.1 | >=5.8 \| <=10.x | ^7.2 \| ^8.0 | New features |
|
||||
15
vendor/maatwebsite/excel/SECURITY.md
vendored
Normal file
15
vendor/maatwebsite/excel/SECURITY.md
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
# Security Policy
|
||||
|
||||
**PLEASE DON'T DISCLOSE SECURITY-RELATED ISSUES PUBLICLY, [SEE BELOW](#reporting-a-vulnerability).**
|
||||
|
||||
## Supported Versions
|
||||
|
||||
Version | Security Fixes Until
|
||||
--- | ---
|
||||
3.1 | -
|
||||
3.0 | 31-12-2018
|
||||
2.1 | 15-5-2018
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
If you discover a security vulnerability within Laravel Excel, please send an email to Patrick Brouwers at patrick@spartner.nl. All security vulnerabilities will be promptly addressed.
|
||||
56
vendor/maatwebsite/excel/composer.json
vendored
Normal file
56
vendor/maatwebsite/excel/composer.json
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
{
|
||||
"name": "maatwebsite/excel",
|
||||
"description": "Supercharged Excel exports and imports in Laravel",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"laravel",
|
||||
"php",
|
||||
"phpspreadsheet",
|
||||
"phpexcel",
|
||||
"excel",
|
||||
"csv",
|
||||
"export",
|
||||
"import",
|
||||
"batch"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Patrick Brouwers",
|
||||
"email": "patrick@spartner.nl"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"ext-json": "*",
|
||||
"php": "^7.0|^8.0",
|
||||
"phpoffice/phpspreadsheet": "^1.18",
|
||||
"illuminate/support": "5.8.*|^6.0|^7.0|^8.0|^9.0|^10.0",
|
||||
"psr/simple-cache": "^1.0|^2.0|^3.0",
|
||||
"composer/semver": "^3.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"orchestra/testbench": "^6.0|^7.0|^8.0",
|
||||
"predis/predis": "^1.1"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Maatwebsite\\Excel\\": "src/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Maatwebsite\\Excel\\Tests\\": "tests/"
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Maatwebsite\\Excel\\ExcelServiceProvider"
|
||||
],
|
||||
"aliases": {
|
||||
"Excel": "Maatwebsite\\Excel\\Facades\\Excel"
|
||||
}
|
||||
}
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true
|
||||
}
|
||||
333
vendor/maatwebsite/excel/config/excel.php
vendored
Normal file
333
vendor/maatwebsite/excel/config/excel.php
vendored
Normal file
@@ -0,0 +1,333 @@
|
||||
<?php
|
||||
|
||||
use Maatwebsite\Excel\Excel;
|
||||
|
||||
return [
|
||||
'exports' => [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Chunk size
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When using FromQuery, the query is automatically chunked.
|
||||
| Here you can specify how big the chunk should be.
|
||||
|
|
||||
*/
|
||||
'chunk_size' => 1000,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Pre-calculate formulas during export
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
'pre_calculate_formulas' => false,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Enable strict null comparison
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When enabling strict null comparison empty cells ('') will
|
||||
| be added to the sheet.
|
||||
*/
|
||||
'strict_null_comparison' => false,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| CSV Settings
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Configure e.g. delimiter, enclosure and line ending for CSV exports.
|
||||
|
|
||||
*/
|
||||
'csv' => [
|
||||
'delimiter' => ',',
|
||||
'enclosure' => '"',
|
||||
'line_ending' => PHP_EOL,
|
||||
'use_bom' => false,
|
||||
'include_separator_line' => false,
|
||||
'excel_compatibility' => false,
|
||||
'output_encoding' => '',
|
||||
'test_auto_detect' => true,
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Worksheet properties
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Configure e.g. default title, creator, subject,...
|
||||
|
|
||||
*/
|
||||
'properties' => [
|
||||
'creator' => '',
|
||||
'lastModifiedBy' => '',
|
||||
'title' => '',
|
||||
'description' => '',
|
||||
'subject' => '',
|
||||
'keywords' => '',
|
||||
'category' => '',
|
||||
'manager' => '',
|
||||
'company' => '',
|
||||
],
|
||||
],
|
||||
|
||||
'imports' => [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Read Only
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When dealing with imports, you might only be interested in the
|
||||
| data that the sheet exists. By default we ignore all styles,
|
||||
| however if you want to do some logic based on style data
|
||||
| you can enable it by setting read_only to false.
|
||||
|
|
||||
*/
|
||||
'read_only' => true,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Ignore Empty
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When dealing with imports, you might be interested in ignoring
|
||||
| rows that have null values or empty strings. By default rows
|
||||
| containing empty strings or empty values are not ignored but can be
|
||||
| ignored by enabling the setting ignore_empty to true.
|
||||
|
|
||||
*/
|
||||
'ignore_empty' => false,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Heading Row Formatter
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Configure the heading row formatter.
|
||||
| Available options: none|slug|custom
|
||||
|
|
||||
*/
|
||||
'heading_row' => [
|
||||
'formatter' => 'slug',
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| CSV Settings
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Configure e.g. delimiter, enclosure and line ending for CSV imports.
|
||||
|
|
||||
*/
|
||||
'csv' => [
|
||||
'delimiter' => null,
|
||||
'enclosure' => '"',
|
||||
'escape_character' => '\\',
|
||||
'contiguous' => false,
|
||||
'input_encoding' => 'UTF-8',
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Worksheet properties
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Configure e.g. default title, creator, subject,...
|
||||
|
|
||||
*/
|
||||
'properties' => [
|
||||
'creator' => '',
|
||||
'lastModifiedBy' => '',
|
||||
'title' => '',
|
||||
'description' => '',
|
||||
'subject' => '',
|
||||
'keywords' => '',
|
||||
'category' => '',
|
||||
'manager' => '',
|
||||
'company' => '',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Extension detector
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Configure here which writer/reader type should be used when the package
|
||||
| needs to guess the correct type based on the extension alone.
|
||||
|
|
||||
*/
|
||||
'extension_detector' => [
|
||||
'xlsx' => Excel::XLSX,
|
||||
'xlsm' => Excel::XLSX,
|
||||
'xltx' => Excel::XLSX,
|
||||
'xltm' => Excel::XLSX,
|
||||
'xls' => Excel::XLS,
|
||||
'xlt' => Excel::XLS,
|
||||
'ods' => Excel::ODS,
|
||||
'ots' => Excel::ODS,
|
||||
'slk' => Excel::SLK,
|
||||
'xml' => Excel::XML,
|
||||
'gnumeric' => Excel::GNUMERIC,
|
||||
'htm' => Excel::HTML,
|
||||
'html' => Excel::HTML,
|
||||
'csv' => Excel::CSV,
|
||||
'tsv' => Excel::TSV,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| PDF Extension
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Configure here which Pdf driver should be used by default.
|
||||
| Available options: Excel::MPDF | Excel::TCPDF | Excel::DOMPDF
|
||||
|
|
||||
*/
|
||||
'pdf' => Excel::DOMPDF,
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Value Binder
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| PhpSpreadsheet offers a way to hook into the process of a value being
|
||||
| written to a cell. In there some assumptions are made on how the
|
||||
| value should be formatted. If you want to change those defaults,
|
||||
| you can implement your own default value binder.
|
||||
|
|
||||
| Possible value binders:
|
||||
|
|
||||
| [x] Maatwebsite\Excel\DefaultValueBinder::class
|
||||
| [x] PhpOffice\PhpSpreadsheet\Cell\StringValueBinder::class
|
||||
| [x] PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder::class
|
||||
|
|
||||
*/
|
||||
'value_binder' => [
|
||||
'default' => Maatwebsite\Excel\DefaultValueBinder::class,
|
||||
],
|
||||
|
||||
'cache' => [
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default cell caching driver
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| By default PhpSpreadsheet keeps all cell values in memory, however when
|
||||
| dealing with large files, this might result into memory issues. If you
|
||||
| want to mitigate that, you can configure a cell caching driver here.
|
||||
| When using the illuminate driver, it will store each value in the
|
||||
| cache store. This can slow down the process, because it needs to
|
||||
| store each value. You can use the "batch" store if you want to
|
||||
| only persist to the store when the memory limit is reached.
|
||||
|
|
||||
| Drivers: memory|illuminate|batch
|
||||
|
|
||||
*/
|
||||
'driver' => 'memory',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Batch memory caching
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When dealing with the "batch" caching driver, it will only
|
||||
| persist to the store when the memory limit is reached.
|
||||
| Here you can tweak the memory limit to your liking.
|
||||
|
|
||||
*/
|
||||
'batch' => [
|
||||
'memory_limit' => 60000,
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Illuminate cache
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When using the "illuminate" caching driver, it will automatically use
|
||||
| your default cache store. However if you prefer to have the cell
|
||||
| cache on a separate store, you can configure the store name here.
|
||||
| You can use any store defined in your cache config. When leaving
|
||||
| at "null" it will use the default store.
|
||||
|
|
||||
*/
|
||||
'illuminate' => [
|
||||
'store' => null,
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Transaction Handler
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| By default the import is wrapped in a transaction. This is useful
|
||||
| for when an import may fail and you want to retry it. With the
|
||||
| transactions, the previous import gets rolled-back.
|
||||
|
|
||||
| You can disable the transaction handler by setting this to null.
|
||||
| Or you can choose a custom made transaction handler here.
|
||||
|
|
||||
| Supported handlers: null|db
|
||||
|
|
||||
*/
|
||||
'transactions' => [
|
||||
'handler' => 'db',
|
||||
'db' => [
|
||||
'connection' => null,
|
||||
],
|
||||
],
|
||||
|
||||
'temporary_files' => [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Local Temporary Path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When exporting and importing files, we use a temporary file, before
|
||||
| storing reading or downloading. Here you can customize that path.
|
||||
|
|
||||
*/
|
||||
'local_path' => storage_path('framework/cache/laravel-excel'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Remote Temporary Disk
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When dealing with a multi server setup with queues in which you
|
||||
| cannot rely on having a shared local temporary path, you might
|
||||
| want to store the temporary file on a shared disk. During the
|
||||
| queue executing, we'll retrieve the temporary file from that
|
||||
| location instead. When left to null, it will always use
|
||||
| the local path. This setting only has effect when using
|
||||
| in conjunction with queued imports and exports.
|
||||
|
|
||||
*/
|
||||
'remote_disk' => null,
|
||||
'remote_prefix' => null,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Force Resync
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When dealing with a multi server setup as above, it's possible
|
||||
| for the clean up that occurs after entire queue has been run to only
|
||||
| cleanup the server that the last AfterImportJob runs on. The rest of the server
|
||||
| would still have the local temporary file stored on it. In this case your
|
||||
| local storage limits can be exceeded and future imports won't be processed.
|
||||
| To mitigate this you can set this config value to be true, so that after every
|
||||
| queued chunk is processed the local temporary file is deleted on the server that
|
||||
| processed it.
|
||||
|
|
||||
*/
|
||||
'force_resync_remote' => null,
|
||||
],
|
||||
];
|
||||
142
vendor/maatwebsite/excel/src/Cache/BatchCache.php
vendored
Normal file
142
vendor/maatwebsite/excel/src/Cache/BatchCache.php
vendored
Normal file
@@ -0,0 +1,142 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Cache;
|
||||
|
||||
use Psr\SimpleCache\CacheInterface;
|
||||
|
||||
class BatchCache implements CacheInterface
|
||||
{
|
||||
/**
|
||||
* @var CacheInterface
|
||||
*/
|
||||
protected $cache;
|
||||
|
||||
/**
|
||||
* @var MemoryCache
|
||||
*/
|
||||
protected $memory;
|
||||
|
||||
/**
|
||||
* @param CacheInterface $cache
|
||||
* @param MemoryCache $memory
|
||||
*/
|
||||
public function __construct(CacheInterface $cache, MemoryCache $memory)
|
||||
{
|
||||
$this->cache = $cache;
|
||||
$this->memory = $memory;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get(string $key, mixed $default = null): mixed
|
||||
{
|
||||
if ($this->memory->has($key)) {
|
||||
return $this->memory->get($key);
|
||||
}
|
||||
|
||||
return $this->cache->get($key, $default);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function set(string $key, mixed $value, null|int|\DateInterval $ttl = null): bool
|
||||
{
|
||||
$this->memory->set($key, $value, $ttl);
|
||||
|
||||
if ($this->memory->reachedMemoryLimit()) {
|
||||
return $this->cache->setMultiple($this->memory->flush(), $ttl);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function delete(string $key): bool
|
||||
{
|
||||
if ($this->memory->has($key)) {
|
||||
return $this->memory->delete($key);
|
||||
}
|
||||
|
||||
return $this->cache->delete($key);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function clear(): bool
|
||||
{
|
||||
$this->memory->clear();
|
||||
|
||||
return $this->cache->clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getMultiple(iterable $keys, mixed $default = null): iterable
|
||||
{
|
||||
// Check if all keys are still in memory
|
||||
$memory = $this->memory->getMultiple($keys, $default);
|
||||
$actualItemsInMemory = count(array_filter($memory));
|
||||
|
||||
if ($actualItemsInMemory === count($keys)) {
|
||||
return $memory;
|
||||
}
|
||||
|
||||
// Get all rows from cache if none is hold in memory.
|
||||
if ($actualItemsInMemory === 0) {
|
||||
return $this->cache->getMultiple($keys, $default);
|
||||
}
|
||||
|
||||
// Add missing values from cache.
|
||||
foreach ($this->cache->getMultiple($keys, $default) as $key => $value) {
|
||||
if (null !== $value) {
|
||||
$memory[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $memory;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setMultiple(iterable $values, null|int|\DateInterval $ttl = null): bool
|
||||
{
|
||||
$this->memory->setMultiple($values, $ttl);
|
||||
|
||||
if ($this->memory->reachedMemoryLimit()) {
|
||||
return $this->cache->setMultiple($this->memory->flush(), $ttl);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function deleteMultiple(iterable $keys): bool
|
||||
{
|
||||
$keys = is_array($keys) ? $keys : iterator_to_array($keys);
|
||||
|
||||
$this->memory->deleteMultiple($keys);
|
||||
|
||||
return $this->cache->deleteMultiple($keys);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function has(string $key): bool
|
||||
{
|
||||
if ($this->memory->has($key)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return $this->cache->has($key);
|
||||
}
|
||||
}
|
||||
142
vendor/maatwebsite/excel/src/Cache/BatchCacheDeprecated.php
vendored
Normal file
142
vendor/maatwebsite/excel/src/Cache/BatchCacheDeprecated.php
vendored
Normal file
@@ -0,0 +1,142 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Cache;
|
||||
|
||||
use Psr\SimpleCache\CacheInterface;
|
||||
|
||||
class BatchCacheDeprecated implements CacheInterface
|
||||
{
|
||||
/**
|
||||
* @var CacheInterface
|
||||
*/
|
||||
protected $cache;
|
||||
|
||||
/**
|
||||
* @var MemoryCacheDeprecated
|
||||
*/
|
||||
protected $memory;
|
||||
|
||||
/**
|
||||
* @param CacheInterface $cache
|
||||
* @param MemoryCacheDeprecated $memory
|
||||
*/
|
||||
public function __construct(CacheInterface $cache, MemoryCacheDeprecated $memory)
|
||||
{
|
||||
$this->cache = $cache;
|
||||
$this->memory = $memory;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get($key, $default = null)
|
||||
{
|
||||
if ($this->memory->has($key)) {
|
||||
return $this->memory->get($key);
|
||||
}
|
||||
|
||||
return $this->cache->get($key, $default);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function set($key, $value, $ttl = null)
|
||||
{
|
||||
$this->memory->set($key, $value, $ttl);
|
||||
|
||||
if ($this->memory->reachedMemoryLimit()) {
|
||||
return $this->cache->setMultiple($this->memory->flush(), $ttl);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function delete($key)
|
||||
{
|
||||
if ($this->memory->has($key)) {
|
||||
return $this->memory->delete($key);
|
||||
}
|
||||
|
||||
return $this->cache->delete($key);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function clear()
|
||||
{
|
||||
$this->memory->clear();
|
||||
|
||||
return $this->cache->clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getMultiple($keys, $default = null)
|
||||
{
|
||||
// Check if all keys are still in memory
|
||||
$memory = $this->memory->getMultiple($keys, $default);
|
||||
$actualItemsInMemory = count(array_filter($memory));
|
||||
|
||||
if ($actualItemsInMemory === count($keys)) {
|
||||
return $memory;
|
||||
}
|
||||
|
||||
// Get all rows from cache if none is hold in memory.
|
||||
if ($actualItemsInMemory === 0) {
|
||||
return $this->cache->getMultiple($keys, $default);
|
||||
}
|
||||
|
||||
// Add missing values from cache.
|
||||
foreach ($this->cache->getMultiple($keys, $default) as $key => $value) {
|
||||
if (null !== $value) {
|
||||
$memory[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $memory;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setMultiple($values, $ttl = null)
|
||||
{
|
||||
$this->memory->setMultiple($values, $ttl);
|
||||
|
||||
if ($this->memory->reachedMemoryLimit()) {
|
||||
return $this->cache->setMultiple($this->memory->flush(), $ttl);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function deleteMultiple($keys)
|
||||
{
|
||||
$keys = is_array($keys) ? $keys : iterator_to_array($keys);
|
||||
|
||||
$this->memory->deleteMultiple($keys);
|
||||
|
||||
return $this->cache->deleteMultiple($keys);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function has($key)
|
||||
{
|
||||
if ($this->memory->has($key)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return $this->cache->has($key);
|
||||
}
|
||||
}
|
||||
91
vendor/maatwebsite/excel/src/Cache/CacheManager.php
vendored
Normal file
91
vendor/maatwebsite/excel/src/Cache/CacheManager.php
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Cache;
|
||||
|
||||
use Composer\InstalledVersions;
|
||||
use Composer\Semver\VersionParser;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Manager;
|
||||
use Psr\SimpleCache\CacheInterface;
|
||||
|
||||
class CacheManager extends Manager
|
||||
{
|
||||
/**
|
||||
* @const string
|
||||
*/
|
||||
public const DRIVER_BATCH = 'batch';
|
||||
|
||||
/**
|
||||
* @const string
|
||||
*/
|
||||
public const DRIVER_MEMORY = 'memory';
|
||||
|
||||
/**
|
||||
* @const string
|
||||
*/
|
||||
public const DRIVER_ILLUMINATE = 'illuminate';
|
||||
|
||||
/**
|
||||
* Get the default driver name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDefaultDriver(): string
|
||||
{
|
||||
return config('excel.cache.driver', 'memory');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MemoryCache
|
||||
*/
|
||||
public function createMemoryDriver(): CacheInterface
|
||||
{
|
||||
if (!InstalledVersions::satisfies(new VersionParser, 'psr/simple-cache', '^3.0')) {
|
||||
return new MemoryCacheDeprecated(
|
||||
config('excel.cache.batch.memory_limit', 60000)
|
||||
);
|
||||
}
|
||||
|
||||
return new MemoryCache(
|
||||
config('excel.cache.batch.memory_limit', 60000)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BatchCache
|
||||
*/
|
||||
public function createBatchDriver(): CacheInterface
|
||||
{
|
||||
if (!InstalledVersions::satisfies(new VersionParser, 'psr/simple-cache', '^3.0')) {
|
||||
return new BatchCacheDeprecated(
|
||||
$this->createIlluminateDriver(),
|
||||
$this->createMemoryDriver()
|
||||
);
|
||||
}
|
||||
|
||||
return new BatchCache(
|
||||
$this->createIlluminateDriver(),
|
||||
$this->createMemoryDriver()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return CacheInterface
|
||||
*/
|
||||
public function createIlluminateDriver(): CacheInterface
|
||||
{
|
||||
return Cache::driver(
|
||||
config('excel.cache.illuminate.store')
|
||||
);
|
||||
}
|
||||
|
||||
public function flush()
|
||||
{
|
||||
$this->driver()->clear();
|
||||
}
|
||||
|
||||
public function isInMemory(): bool
|
||||
{
|
||||
return $this->getDefaultDriver() === self::DRIVER_MEMORY;
|
||||
}
|
||||
}
|
||||
138
vendor/maatwebsite/excel/src/Cache/MemoryCache.php
vendored
Normal file
138
vendor/maatwebsite/excel/src/Cache/MemoryCache.php
vendored
Normal file
@@ -0,0 +1,138 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Cache;
|
||||
|
||||
use Psr\SimpleCache\CacheInterface;
|
||||
|
||||
class MemoryCache implements CacheInterface
|
||||
{
|
||||
/**
|
||||
* @var int|null
|
||||
*/
|
||||
protected $memoryLimit;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $cache = [];
|
||||
|
||||
/**
|
||||
* @param int|null $memoryLimit
|
||||
*/
|
||||
public function __construct(int $memoryLimit = null)
|
||||
{
|
||||
$this->memoryLimit = $memoryLimit;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function clear(): bool
|
||||
{
|
||||
$this->cache = [];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function delete(string $key): bool
|
||||
{
|
||||
unset($this->cache[$key]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function deleteMultiple($keys): bool
|
||||
{
|
||||
foreach ($keys as $key) {
|
||||
$this->delete($key);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get(string $key, mixed $default = null): mixed
|
||||
{
|
||||
if ($this->has($key)) {
|
||||
return $this->cache[$key];
|
||||
}
|
||||
|
||||
return $default;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getMultiple(iterable $keys, mixed $default = null): iterable
|
||||
{
|
||||
$results = [];
|
||||
foreach ($keys as $key) {
|
||||
$results[$key] = $this->get($key, $default);
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function has($key): bool
|
||||
{
|
||||
return isset($this->cache[$key]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function set(string $key, mixed $value, null|int|\DateInterval $ttl = null): bool
|
||||
{
|
||||
$this->cache[$key] = $value;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setMultiple($values, $ttl = null): bool
|
||||
{
|
||||
foreach ($values as $key => $value) {
|
||||
$this->set($key, $value);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function reachedMemoryLimit(): bool
|
||||
{
|
||||
// When no limit is given, we'll never reach any limit.
|
||||
if (null === $this->memoryLimit) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return count($this->cache) >= $this->memoryLimit;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function flush(): array
|
||||
{
|
||||
$memory = $this->cache;
|
||||
|
||||
$this->clear();
|
||||
|
||||
return $memory;
|
||||
}
|
||||
}
|
||||
138
vendor/maatwebsite/excel/src/Cache/MemoryCacheDeprecated.php
vendored
Normal file
138
vendor/maatwebsite/excel/src/Cache/MemoryCacheDeprecated.php
vendored
Normal file
@@ -0,0 +1,138 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Cache;
|
||||
|
||||
use Psr\SimpleCache\CacheInterface;
|
||||
|
||||
class MemoryCacheDeprecated implements CacheInterface
|
||||
{
|
||||
/**
|
||||
* @var int|null
|
||||
*/
|
||||
protected $memoryLimit;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $cache = [];
|
||||
|
||||
/**
|
||||
* @param int|null $memoryLimit
|
||||
*/
|
||||
public function __construct(int $memoryLimit = null)
|
||||
{
|
||||
$this->memoryLimit = $memoryLimit;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function clear()
|
||||
{
|
||||
$this->cache = [];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function delete($key)
|
||||
{
|
||||
unset($this->cache[$key]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function deleteMultiple($keys)
|
||||
{
|
||||
foreach ($keys as $key) {
|
||||
$this->delete($key);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get($key, $default = null)
|
||||
{
|
||||
if ($this->has($key)) {
|
||||
return $this->cache[$key];
|
||||
}
|
||||
|
||||
return $default;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getMultiple($keys, $default = null)
|
||||
{
|
||||
$results = [];
|
||||
foreach ($keys as $key) {
|
||||
$results[$key] = $this->get($key, $default);
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function has($key)
|
||||
{
|
||||
return isset($this->cache[$key]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function set($key, $value, $ttl = null)
|
||||
{
|
||||
$this->cache[$key] = $value;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setMultiple($values, $ttl = null)
|
||||
{
|
||||
foreach ($values as $key => $value) {
|
||||
$this->set($key, $value);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function reachedMemoryLimit(): bool
|
||||
{
|
||||
// When no limit is given, we'll never reach any limit.
|
||||
if (null === $this->memoryLimit) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return count($this->cache) >= $this->memoryLimit;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function flush(): array
|
||||
{
|
||||
$memory = $this->cache;
|
||||
|
||||
$this->clear();
|
||||
|
||||
return $memory;
|
||||
}
|
||||
}
|
||||
82
vendor/maatwebsite/excel/src/Cell.php
vendored
Normal file
82
vendor/maatwebsite/excel/src/Cell.php
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel;
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Calculation\Exception;
|
||||
use PhpOffice\PhpSpreadsheet\Cell\Cell as SpreadsheetCell;
|
||||
use PhpOffice\PhpSpreadsheet\RichText\RichText;
|
||||
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
||||
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
||||
|
||||
/** @mixin SpreadsheetCell */
|
||||
class Cell
|
||||
{
|
||||
use DelegatedMacroable;
|
||||
|
||||
/**
|
||||
* @var SpreadsheetCell
|
||||
*/
|
||||
private $cell;
|
||||
|
||||
/**
|
||||
* @param SpreadsheetCell $cell
|
||||
*/
|
||||
public function __construct(SpreadsheetCell $cell)
|
||||
{
|
||||
$this->cell = $cell;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Worksheet $worksheet
|
||||
* @param string $coordinate
|
||||
* @return Cell
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*/
|
||||
public static function make(Worksheet $worksheet, string $coordinate)
|
||||
{
|
||||
return new static($worksheet->getCell($coordinate));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return SpreadsheetCell
|
||||
*/
|
||||
public function getDelegate(): SpreadsheetCell
|
||||
{
|
||||
return $this->cell;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null $nullValue
|
||||
* @param bool $calculateFormulas
|
||||
* @param bool $formatData
|
||||
* @return mixed
|
||||
*/
|
||||
public function getValue($nullValue = null, $calculateFormulas = false, $formatData = true)
|
||||
{
|
||||
$value = $nullValue;
|
||||
if ($this->cell->getValue() !== null) {
|
||||
if ($this->cell->getValue() instanceof RichText) {
|
||||
$value = $this->cell->getValue()->getPlainText();
|
||||
} elseif ($calculateFormulas) {
|
||||
try {
|
||||
$value = $this->cell->getCalculatedValue();
|
||||
} catch (Exception $e) {
|
||||
$value = $this->cell->getOldCalculatedValue();
|
||||
}
|
||||
} else {
|
||||
$value = $this->cell->getValue();
|
||||
}
|
||||
|
||||
if ($formatData) {
|
||||
$style = $this->cell->getWorksheet()->getParent()->getCellXfByIndex($this->cell->getXfIndex());
|
||||
$value = NumberFormat::toFormattedString(
|
||||
$value,
|
||||
($style && $style->getNumberFormat()) ? $style->getNumberFormat()->getFormatCode() : NumberFormat::FORMAT_GENERAL
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
145
vendor/maatwebsite/excel/src/ChunkReader.php
vendored
Normal file
145
vendor/maatwebsite/excel/src/ChunkReader.php
vendored
Normal file
@@ -0,0 +1,145 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Container\Container;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\PendingDispatch;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\Jobs\SyncJob;
|
||||
use Illuminate\Support\Collection;
|
||||
use Maatwebsite\Excel\Concerns\ShouldQueueWithoutChain;
|
||||
use Maatwebsite\Excel\Concerns\WithChunkReading;
|
||||
use Maatwebsite\Excel\Concerns\WithEvents;
|
||||
use Maatwebsite\Excel\Concerns\WithLimit;
|
||||
use Maatwebsite\Excel\Concerns\WithProgressBar;
|
||||
use Maatwebsite\Excel\Events\BeforeImport;
|
||||
use Maatwebsite\Excel\Files\TemporaryFile;
|
||||
use Maatwebsite\Excel\Imports\HeadingRowExtractor;
|
||||
use Maatwebsite\Excel\Jobs\AfterImportJob;
|
||||
use Maatwebsite\Excel\Jobs\QueueImport;
|
||||
use Maatwebsite\Excel\Jobs\ReadChunk;
|
||||
use Throwable;
|
||||
|
||||
class ChunkReader
|
||||
{
|
||||
/**
|
||||
* @var Container
|
||||
*/
|
||||
protected $container;
|
||||
|
||||
public function __construct(Container $container)
|
||||
{
|
||||
$this->container = $container;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param WithChunkReading $import
|
||||
* @param Reader $reader
|
||||
* @param TemporaryFile $temporaryFile
|
||||
* @return \Illuminate\Foundation\Bus\PendingDispatch|null
|
||||
*/
|
||||
public function read(WithChunkReading $import, Reader $reader, TemporaryFile $temporaryFile)
|
||||
{
|
||||
if ($import instanceof WithEvents && isset($import->registerEvents()[BeforeImport::class])) {
|
||||
$reader->beforeImport($import);
|
||||
}
|
||||
|
||||
$chunkSize = $import->chunkSize();
|
||||
$totalRows = $reader->getTotalRows();
|
||||
$worksheets = $reader->getWorksheets($import);
|
||||
$queue = property_exists($import, 'queue') ? $import->queue : null;
|
||||
$delayCleanup = property_exists($import, 'delayCleanup') ? $import->delayCleanup : 600;
|
||||
|
||||
if ($import instanceof WithProgressBar) {
|
||||
$import->getConsoleOutput()->progressStart(array_sum($totalRows));
|
||||
}
|
||||
|
||||
$jobs = new Collection();
|
||||
foreach ($worksheets as $name => $sheetImport) {
|
||||
$startRow = HeadingRowExtractor::determineStartRow($sheetImport);
|
||||
|
||||
if ($sheetImport instanceof WithLimit) {
|
||||
$limit = $sheetImport->limit();
|
||||
|
||||
if ($limit <= $totalRows[$name]) {
|
||||
$totalRows[$name] = $sheetImport->limit();
|
||||
}
|
||||
}
|
||||
|
||||
for ($currentRow = $startRow; $currentRow <= $totalRows[$name]; $currentRow += $chunkSize) {
|
||||
$jobs->push(new ReadChunk(
|
||||
$import,
|
||||
$reader->getPhpSpreadsheetReader(),
|
||||
$temporaryFile,
|
||||
$name,
|
||||
$sheetImport,
|
||||
$currentRow,
|
||||
$chunkSize
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
$afterImportJob = new AfterImportJob($import, $reader);
|
||||
|
||||
if ($import instanceof ShouldQueueWithoutChain) {
|
||||
$jobs->push($afterImportJob->delay($delayCleanup));
|
||||
|
||||
return $jobs->each(function ($job) use ($queue) {
|
||||
dispatch($job->onQueue($queue));
|
||||
});
|
||||
}
|
||||
|
||||
$jobs->push($afterImportJob);
|
||||
|
||||
if ($import instanceof ShouldQueue) {
|
||||
return new PendingDispatch(
|
||||
(new QueueImport($import))->chain($jobs->toArray())
|
||||
);
|
||||
}
|
||||
|
||||
$jobs->each(function ($job) {
|
||||
try {
|
||||
function_exists('dispatch_now')
|
||||
? dispatch_now($job)
|
||||
: $this->dispatchNow($job);
|
||||
} catch (Throwable $e) {
|
||||
if (method_exists($job, 'failed')) {
|
||||
$job->failed($e);
|
||||
}
|
||||
throw $e;
|
||||
}
|
||||
});
|
||||
|
||||
if ($import instanceof WithProgressBar) {
|
||||
$import->getConsoleOutput()->progressFinish();
|
||||
}
|
||||
|
||||
unset($jobs);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatch a command to its appropriate handler in the current process without using the synchronous queue.
|
||||
*
|
||||
* @param object $command
|
||||
* @param mixed $handler
|
||||
* @return mixed
|
||||
*/
|
||||
protected function dispatchNow($command, $handler = null)
|
||||
{
|
||||
$uses = class_uses_recursive($command);
|
||||
|
||||
if (in_array(InteractsWithQueue::class, $uses) &&
|
||||
in_array(Queueable::class, $uses) && !$command->job
|
||||
) {
|
||||
$command->setJob(new SyncJob($this->container, json_encode([]), 'sync', 'sync'));
|
||||
}
|
||||
|
||||
$method = method_exists($command, 'handle') ? 'handle' : '__invoke';
|
||||
|
||||
return $this->container->call([$command, $method]);
|
||||
}
|
||||
}
|
||||
116
vendor/maatwebsite/excel/src/Concerns/Exportable.php
vendored
Normal file
116
vendor/maatwebsite/excel/src/Concerns/Exportable.php
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
use Illuminate\Foundation\Bus\PendingDispatch;
|
||||
use Maatwebsite\Excel\Exceptions\NoFilenameGivenException;
|
||||
use Maatwebsite\Excel\Exceptions\NoFilePathGivenException;
|
||||
use Maatwebsite\Excel\Exporter;
|
||||
|
||||
trait Exportable
|
||||
{
|
||||
/**
|
||||
* @param string $fileName
|
||||
* @param string|null $writerType
|
||||
* @param array $headers
|
||||
* @return \Illuminate\Http\Response|\Symfony\Component\HttpFoundation\BinaryFileResponse
|
||||
*
|
||||
* @throws NoFilenameGivenException
|
||||
*/
|
||||
public function download(string $fileName = null, string $writerType = null, array $headers = null)
|
||||
{
|
||||
$headers = $headers ?? $this->headers ?? [];
|
||||
$fileName = $fileName ?? $this->fileName ?? null;
|
||||
$writerType = $writerType ?? $this->writerType ?? null;
|
||||
|
||||
if (null === $fileName) {
|
||||
throw new NoFilenameGivenException();
|
||||
}
|
||||
|
||||
return $this->getExporter()->download($this, $fileName, $writerType, $headers);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $filePath
|
||||
* @param string|null $disk
|
||||
* @param string|null $writerType
|
||||
* @param mixed $diskOptions
|
||||
* @return bool|PendingDispatch
|
||||
*
|
||||
* @throws NoFilePathGivenException
|
||||
*/
|
||||
public function store(string $filePath = null, string $disk = null, string $writerType = null, $diskOptions = [])
|
||||
{
|
||||
$filePath = $filePath ?? $this->filePath ?? null;
|
||||
|
||||
if (null === $filePath) {
|
||||
throw NoFilePathGivenException::export();
|
||||
}
|
||||
|
||||
return $this->getExporter()->store(
|
||||
$this,
|
||||
$filePath,
|
||||
$disk ?? $this->disk ?? null,
|
||||
$writerType ?? $this->writerType ?? null,
|
||||
$diskOptions ?: $this->diskOptions ?? []
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $filePath
|
||||
* @param string|null $disk
|
||||
* @param string|null $writerType
|
||||
* @param mixed $diskOptions
|
||||
* @return PendingDispatch
|
||||
*
|
||||
* @throws NoFilePathGivenException
|
||||
*/
|
||||
public function queue(string $filePath = null, string $disk = null, string $writerType = null, $diskOptions = [])
|
||||
{
|
||||
$filePath = $filePath ?? $this->filePath ?? null;
|
||||
|
||||
if (null === $filePath) {
|
||||
throw NoFilePathGivenException::export();
|
||||
}
|
||||
|
||||
return $this->getExporter()->queue(
|
||||
$this,
|
||||
$filePath,
|
||||
$disk ?? $this->disk ?? null,
|
||||
$writerType ?? $this->writerType ?? null,
|
||||
$diskOptions ?: $this->diskOptions ?? []
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $writerType
|
||||
* @return string
|
||||
*/
|
||||
public function raw($writerType = null)
|
||||
{
|
||||
$writerType = $writerType ?? $this->writerType ?? null;
|
||||
|
||||
return $this->getExporter()->raw($this, $writerType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an HTTP response that represents the object.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*
|
||||
* @throws NoFilenameGivenException
|
||||
*/
|
||||
public function toResponse($request)
|
||||
{
|
||||
return $this->download();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Exporter
|
||||
*/
|
||||
private function getExporter(): Exporter
|
||||
{
|
||||
return app(Exporter::class);
|
||||
}
|
||||
}
|
||||
11
vendor/maatwebsite/excel/src/Concerns/FromArray.php
vendored
Normal file
11
vendor/maatwebsite/excel/src/Concerns/FromArray.php
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
interface FromArray
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function array(): array;
|
||||
}
|
||||
13
vendor/maatwebsite/excel/src/Concerns/FromCollection.php
vendored
Normal file
13
vendor/maatwebsite/excel/src/Concerns/FromCollection.php
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
interface FromCollection
|
||||
{
|
||||
/**
|
||||
* @return Collection
|
||||
*/
|
||||
public function collection();
|
||||
}
|
||||
13
vendor/maatwebsite/excel/src/Concerns/FromGenerator.php
vendored
Normal file
13
vendor/maatwebsite/excel/src/Concerns/FromGenerator.php
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
use Generator;
|
||||
|
||||
interface FromGenerator
|
||||
{
|
||||
/**
|
||||
* @return Generator
|
||||
*/
|
||||
public function generator(): Generator;
|
||||
}
|
||||
13
vendor/maatwebsite/excel/src/Concerns/FromIterator.php
vendored
Normal file
13
vendor/maatwebsite/excel/src/Concerns/FromIterator.php
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
use Iterator;
|
||||
|
||||
interface FromIterator
|
||||
{
|
||||
/**
|
||||
* @return Iterator
|
||||
*/
|
||||
public function iterator(): Iterator;
|
||||
}
|
||||
15
vendor/maatwebsite/excel/src/Concerns/FromQuery.php
vendored
Normal file
15
vendor/maatwebsite/excel/src/Concerns/FromQuery.php
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
|
||||
use Illuminate\Database\Eloquent\Relations\Relation;
|
||||
use Illuminate\Database\Query\Builder;
|
||||
|
||||
interface FromQuery
|
||||
{
|
||||
/**
|
||||
* @return Builder|EloquentBuilder|Relation
|
||||
*/
|
||||
public function query();
|
||||
}
|
||||
13
vendor/maatwebsite/excel/src/Concerns/FromView.php
vendored
Normal file
13
vendor/maatwebsite/excel/src/Concerns/FromView.php
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
use Illuminate\Contracts\View\View;
|
||||
|
||||
interface FromView
|
||||
{
|
||||
/**
|
||||
* @return View
|
||||
*/
|
||||
public function view(): View;
|
||||
}
|
||||
7
vendor/maatwebsite/excel/src/Concerns/HasReferencesToOtherSheets.php
vendored
Normal file
7
vendor/maatwebsite/excel/src/Concerns/HasReferencesToOtherSheets.php
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
interface HasReferencesToOtherSheets
|
||||
{
|
||||
}
|
||||
148
vendor/maatwebsite/excel/src/Concerns/Importable.php
vendored
Normal file
148
vendor/maatwebsite/excel/src/Concerns/Importable.php
vendored
Normal file
@@ -0,0 +1,148 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
use Illuminate\Console\OutputStyle;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\PendingDispatch;
|
||||
use Illuminate\Support\Collection;
|
||||
use InvalidArgumentException;
|
||||
use Maatwebsite\Excel\Exceptions\NoFilePathGivenException;
|
||||
use Maatwebsite\Excel\Importer;
|
||||
use Symfony\Component\Console\Input\StringInput;
|
||||
use Symfony\Component\Console\Output\NullOutput;
|
||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||
|
||||
trait Importable
|
||||
{
|
||||
/**
|
||||
* @var OutputStyle|null
|
||||
*/
|
||||
protected $output;
|
||||
|
||||
/**
|
||||
* @param string|UploadedFile|null $filePath
|
||||
* @param string|null $disk
|
||||
* @param string|null $readerType
|
||||
* @return Importer|PendingDispatch
|
||||
*
|
||||
* @throws NoFilePathGivenException
|
||||
*/
|
||||
public function import($filePath = null, string $disk = null, string $readerType = null)
|
||||
{
|
||||
$filePath = $this->getFilePath($filePath);
|
||||
|
||||
return $this->getImporter()->import(
|
||||
$this,
|
||||
$filePath,
|
||||
$disk ?? $this->disk ?? null,
|
||||
$readerType ?? $this->readerType ?? null
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|UploadedFile|null $filePath
|
||||
* @param string|null $disk
|
||||
* @param string|null $readerType
|
||||
* @return array
|
||||
*
|
||||
* @throws NoFilePathGivenException
|
||||
*/
|
||||
public function toArray($filePath = null, string $disk = null, string $readerType = null): array
|
||||
{
|
||||
$filePath = $this->getFilePath($filePath);
|
||||
|
||||
return $this->getImporter()->toArray(
|
||||
$this,
|
||||
$filePath,
|
||||
$disk ?? $this->disk ?? null,
|
||||
$readerType ?? $this->readerType ?? null
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|UploadedFile|null $filePath
|
||||
* @param string|null $disk
|
||||
* @param string|null $readerType
|
||||
* @return Collection
|
||||
*
|
||||
* @throws NoFilePathGivenException
|
||||
*/
|
||||
public function toCollection($filePath = null, string $disk = null, string $readerType = null): Collection
|
||||
{
|
||||
$filePath = $this->getFilePath($filePath);
|
||||
|
||||
return $this->getImporter()->toCollection(
|
||||
$this,
|
||||
$filePath,
|
||||
$disk ?? $this->disk ?? null,
|
||||
$readerType ?? $this->readerType ?? null
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|UploadedFile|null $filePath
|
||||
* @param string|null $disk
|
||||
* @param string|null $readerType
|
||||
* @return PendingDispatch
|
||||
*
|
||||
* @throws NoFilePathGivenException
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function queue($filePath = null, string $disk = null, string $readerType = null)
|
||||
{
|
||||
if (!$this instanceof ShouldQueue) {
|
||||
throw new InvalidArgumentException('Importable should implement ShouldQueue to be queued.');
|
||||
}
|
||||
|
||||
return $this->import($filePath, $disk, $readerType);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param OutputStyle $output
|
||||
* @return $this
|
||||
*/
|
||||
public function withOutput(OutputStyle $output)
|
||||
{
|
||||
$this->output = $output;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return OutputStyle
|
||||
*/
|
||||
public function getConsoleOutput(): OutputStyle
|
||||
{
|
||||
if (!$this->output instanceof OutputStyle) {
|
||||
$this->output = new OutputStyle(new StringInput(''), new NullOutput());
|
||||
}
|
||||
|
||||
return $this->output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param UploadedFile|string|null $filePath
|
||||
* @return UploadedFile|string
|
||||
*
|
||||
* @throws NoFilePathGivenException
|
||||
*/
|
||||
private function getFilePath($filePath = null)
|
||||
{
|
||||
$filePath = $filePath ?? $this->filePath ?? null;
|
||||
|
||||
if (null === $filePath) {
|
||||
throw NoFilePathGivenException::import();
|
||||
}
|
||||
|
||||
return $filePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Importer
|
||||
*/
|
||||
private function getImporter(): Importer
|
||||
{
|
||||
return app(Importer::class);
|
||||
}
|
||||
}
|
||||
81
vendor/maatwebsite/excel/src/Concerns/MapsCsvSettings.php
vendored
Normal file
81
vendor/maatwebsite/excel/src/Concerns/MapsCsvSettings.php
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
trait MapsCsvSettings
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected static $delimiter = ',';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected static $enclosure = '"';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected static $lineEnding = PHP_EOL;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected static $useBom = false;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected static $includeSeparatorLine = false;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected static $excelCompatibility = false;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected static $escapeCharacter = '\\';
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected static $contiguous = false;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected static $inputEncoding = 'UTF-8';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected static $outputEncoding = '';
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected static $testAutoDetect = true;
|
||||
|
||||
/**
|
||||
* @param array $config
|
||||
*/
|
||||
public static function applyCsvSettings(array $config)
|
||||
{
|
||||
static::$delimiter = Arr::get($config, 'delimiter', static::$delimiter);
|
||||
static::$enclosure = Arr::get($config, 'enclosure', static::$enclosure);
|
||||
static::$lineEnding = Arr::get($config, 'line_ending', static::$lineEnding);
|
||||
static::$useBom = Arr::get($config, 'use_bom', static::$useBom);
|
||||
static::$includeSeparatorLine = Arr::get($config, 'include_separator_line', static::$includeSeparatorLine);
|
||||
static::$excelCompatibility = Arr::get($config, 'excel_compatibility', static::$excelCompatibility);
|
||||
static::$escapeCharacter = Arr::get($config, 'escape_character', static::$escapeCharacter);
|
||||
static::$contiguous = Arr::get($config, 'contiguous', static::$contiguous);
|
||||
static::$inputEncoding = Arr::get($config, 'input_encoding', static::$inputEncoding);
|
||||
static::$outputEncoding = Arr::get($config, 'output_encoding', static::$outputEncoding);
|
||||
static::$testAutoDetect = Arr::get($config, 'test_auto_detect', static::$testAutoDetect);
|
||||
}
|
||||
}
|
||||
13
vendor/maatwebsite/excel/src/Concerns/OnEachRow.php
vendored
Normal file
13
vendor/maatwebsite/excel/src/Concerns/OnEachRow.php
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
use Maatwebsite\Excel\Row;
|
||||
|
||||
interface OnEachRow
|
||||
{
|
||||
/**
|
||||
* @param Row $row
|
||||
*/
|
||||
public function onRow(Row $row);
|
||||
}
|
||||
52
vendor/maatwebsite/excel/src/Concerns/RegistersEventListeners.php
vendored
Normal file
52
vendor/maatwebsite/excel/src/Concerns/RegistersEventListeners.php
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
use Maatwebsite\Excel\Events\AfterImport;
|
||||
use Maatwebsite\Excel\Events\AfterSheet;
|
||||
use Maatwebsite\Excel\Events\BeforeExport;
|
||||
use Maatwebsite\Excel\Events\BeforeImport;
|
||||
use Maatwebsite\Excel\Events\BeforeSheet;
|
||||
use Maatwebsite\Excel\Events\BeforeWriting;
|
||||
use Maatwebsite\Excel\Events\ImportFailed;
|
||||
|
||||
trait RegistersEventListeners
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function registerEvents(): array
|
||||
{
|
||||
$listeners = [];
|
||||
|
||||
if (method_exists($this, 'beforeExport')) {
|
||||
$listeners[BeforeExport::class] = [static::class, 'beforeExport'];
|
||||
}
|
||||
|
||||
if (method_exists($this, 'beforeWriting')) {
|
||||
$listeners[BeforeWriting::class] = [static::class, 'beforeWriting'];
|
||||
}
|
||||
|
||||
if (method_exists($this, 'beforeImport')) {
|
||||
$listeners[BeforeImport::class] = [static::class, 'beforeImport'];
|
||||
}
|
||||
|
||||
if (method_exists($this, 'afterImport')) {
|
||||
$listeners[AfterImport::class] = [static::class, 'afterImport'];
|
||||
}
|
||||
|
||||
if (method_exists($this, 'importFailed')) {
|
||||
$listeners[ImportFailed::class] = [static::class, 'importFailed'];
|
||||
}
|
||||
|
||||
if (method_exists($this, 'beforeSheet')) {
|
||||
$listeners[BeforeSheet::class] = [static::class, 'beforeSheet'];
|
||||
}
|
||||
|
||||
if (method_exists($this, 'afterSheet')) {
|
||||
$listeners[AfterSheet::class] = [static::class, 'afterSheet'];
|
||||
}
|
||||
|
||||
return $listeners;
|
||||
}
|
||||
}
|
||||
27
vendor/maatwebsite/excel/src/Concerns/RemembersChunkOffset.php
vendored
Normal file
27
vendor/maatwebsite/excel/src/Concerns/RemembersChunkOffset.php
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
trait RemembersChunkOffset
|
||||
{
|
||||
/**
|
||||
* @var int|null
|
||||
*/
|
||||
protected $chunkOffset;
|
||||
|
||||
/**
|
||||
* @param int $chunkOffset
|
||||
*/
|
||||
public function setChunkOffset(int $chunkOffset)
|
||||
{
|
||||
$this->chunkOffset = $chunkOffset;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int|null
|
||||
*/
|
||||
public function getChunkOffset()
|
||||
{
|
||||
return $this->chunkOffset;
|
||||
}
|
||||
}
|
||||
27
vendor/maatwebsite/excel/src/Concerns/RemembersRowNumber.php
vendored
Normal file
27
vendor/maatwebsite/excel/src/Concerns/RemembersRowNumber.php
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
trait RemembersRowNumber
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $rowNumber;
|
||||
|
||||
/**
|
||||
* @param int $rowNumber
|
||||
*/
|
||||
public function rememberRowNumber(int $rowNumber)
|
||||
{
|
||||
$this->rowNumber = $rowNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int|null
|
||||
*/
|
||||
public function getRowNumber()
|
||||
{
|
||||
return $this->rowNumber;
|
||||
}
|
||||
}
|
||||
7
vendor/maatwebsite/excel/src/Concerns/ShouldAutoSize.php
vendored
Normal file
7
vendor/maatwebsite/excel/src/Concerns/ShouldAutoSize.php
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
interface ShouldAutoSize
|
||||
{
|
||||
}
|
||||
9
vendor/maatwebsite/excel/src/Concerns/ShouldQueueWithoutChain.php
vendored
Normal file
9
vendor/maatwebsite/excel/src/Concerns/ShouldQueueWithoutChain.php
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
|
||||
interface ShouldQueueWithoutChain extends ShouldQueue
|
||||
{
|
||||
}
|
||||
7
vendor/maatwebsite/excel/src/Concerns/SkipsEmptyRows.php
vendored
Normal file
7
vendor/maatwebsite/excel/src/Concerns/SkipsEmptyRows.php
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
interface SkipsEmptyRows
|
||||
{
|
||||
}
|
||||
30
vendor/maatwebsite/excel/src/Concerns/SkipsErrors.php
vendored
Normal file
30
vendor/maatwebsite/excel/src/Concerns/SkipsErrors.php
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
use Illuminate\Support\Collection;
|
||||
use Throwable;
|
||||
|
||||
trait SkipsErrors
|
||||
{
|
||||
/**
|
||||
* @var Throwable[]
|
||||
*/
|
||||
protected $errors = [];
|
||||
|
||||
/**
|
||||
* @param Throwable $e
|
||||
*/
|
||||
public function onError(Throwable $e)
|
||||
{
|
||||
$this->errors[] = $e;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Throwable[]|Collection
|
||||
*/
|
||||
public function errors(): Collection
|
||||
{
|
||||
return new Collection($this->errors);
|
||||
}
|
||||
}
|
||||
30
vendor/maatwebsite/excel/src/Concerns/SkipsFailures.php
vendored
Normal file
30
vendor/maatwebsite/excel/src/Concerns/SkipsFailures.php
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
use Illuminate\Support\Collection;
|
||||
use Maatwebsite\Excel\Validators\Failure;
|
||||
|
||||
trait SkipsFailures
|
||||
{
|
||||
/**
|
||||
* @var Failure[]
|
||||
*/
|
||||
protected $failures = [];
|
||||
|
||||
/**
|
||||
* @param Failure ...$failures
|
||||
*/
|
||||
public function onFailure(Failure ...$failures)
|
||||
{
|
||||
$this->failures = array_merge($this->failures, $failures);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Failure[]|Collection
|
||||
*/
|
||||
public function failures(): Collection
|
||||
{
|
||||
return new Collection($this->failures);
|
||||
}
|
||||
}
|
||||
13
vendor/maatwebsite/excel/src/Concerns/SkipsOnError.php
vendored
Normal file
13
vendor/maatwebsite/excel/src/Concerns/SkipsOnError.php
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
use Throwable;
|
||||
|
||||
interface SkipsOnError
|
||||
{
|
||||
/**
|
||||
* @param Throwable $e
|
||||
*/
|
||||
public function onError(Throwable $e);
|
||||
}
|
||||
13
vendor/maatwebsite/excel/src/Concerns/SkipsOnFailure.php
vendored
Normal file
13
vendor/maatwebsite/excel/src/Concerns/SkipsOnFailure.php
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
use Maatwebsite\Excel\Validators\Failure;
|
||||
|
||||
interface SkipsOnFailure
|
||||
{
|
||||
/**
|
||||
* @param Failure[] $failures
|
||||
*/
|
||||
public function onFailure(Failure ...$failures);
|
||||
}
|
||||
11
vendor/maatwebsite/excel/src/Concerns/SkipsUnknownSheets.php
vendored
Normal file
11
vendor/maatwebsite/excel/src/Concerns/SkipsUnknownSheets.php
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
interface SkipsUnknownSheets
|
||||
{
|
||||
/**
|
||||
* @param string|int $sheetName
|
||||
*/
|
||||
public function onUnknownSheet($sheetName);
|
||||
}
|
||||
11
vendor/maatwebsite/excel/src/Concerns/ToArray.php
vendored
Normal file
11
vendor/maatwebsite/excel/src/Concerns/ToArray.php
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
interface ToArray
|
||||
{
|
||||
/**
|
||||
* @param array $array
|
||||
*/
|
||||
public function array(array $array);
|
||||
}
|
||||
13
vendor/maatwebsite/excel/src/Concerns/ToCollection.php
vendored
Normal file
13
vendor/maatwebsite/excel/src/Concerns/ToCollection.php
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
interface ToCollection
|
||||
{
|
||||
/**
|
||||
* @param Collection $collection
|
||||
*/
|
||||
public function collection(Collection $collection);
|
||||
}
|
||||
14
vendor/maatwebsite/excel/src/Concerns/ToModel.php
vendored
Normal file
14
vendor/maatwebsite/excel/src/Concerns/ToModel.php
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
interface ToModel
|
||||
{
|
||||
/**
|
||||
* @param array $row
|
||||
* @return Model|Model[]|null
|
||||
*/
|
||||
public function model(array $row);
|
||||
}
|
||||
13
vendor/maatwebsite/excel/src/Concerns/WithBackgroundColor.php
vendored
Normal file
13
vendor/maatwebsite/excel/src/Concerns/WithBackgroundColor.php
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Style\Color;
|
||||
|
||||
interface WithBackgroundColor
|
||||
{
|
||||
/**
|
||||
* @return string|array|Color
|
||||
*/
|
||||
public function backgroundColor();
|
||||
}
|
||||
11
vendor/maatwebsite/excel/src/Concerns/WithBatchInserts.php
vendored
Normal file
11
vendor/maatwebsite/excel/src/Concerns/WithBatchInserts.php
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
interface WithBatchInserts
|
||||
{
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function batchSize(): int;
|
||||
}
|
||||
7
vendor/maatwebsite/excel/src/Concerns/WithCalculatedFormulas.php
vendored
Normal file
7
vendor/maatwebsite/excel/src/Concerns/WithCalculatedFormulas.php
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
interface WithCalculatedFormulas
|
||||
{
|
||||
}
|
||||
13
vendor/maatwebsite/excel/src/Concerns/WithCharts.php
vendored
Normal file
13
vendor/maatwebsite/excel/src/Concerns/WithCharts.php
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Chart\Chart;
|
||||
|
||||
interface WithCharts
|
||||
{
|
||||
/**
|
||||
* @return Chart|Chart[]
|
||||
*/
|
||||
public function charts();
|
||||
}
|
||||
11
vendor/maatwebsite/excel/src/Concerns/WithChunkReading.php
vendored
Normal file
11
vendor/maatwebsite/excel/src/Concerns/WithChunkReading.php
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
interface WithChunkReading
|
||||
{
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function chunkSize(): int;
|
||||
}
|
||||
11
vendor/maatwebsite/excel/src/Concerns/WithColumnFormatting.php
vendored
Normal file
11
vendor/maatwebsite/excel/src/Concerns/WithColumnFormatting.php
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
interface WithColumnFormatting
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function columnFormats(): array;
|
||||
}
|
||||
8
vendor/maatwebsite/excel/src/Concerns/WithColumnLimit.php
vendored
Normal file
8
vendor/maatwebsite/excel/src/Concerns/WithColumnLimit.php
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
interface WithColumnLimit
|
||||
{
|
||||
public function endColumn(): string;
|
||||
}
|
||||
8
vendor/maatwebsite/excel/src/Concerns/WithColumnWidths.php
vendored
Normal file
8
vendor/maatwebsite/excel/src/Concerns/WithColumnWidths.php
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
interface WithColumnWidths
|
||||
{
|
||||
public function columnWidths(): array;
|
||||
}
|
||||
37
vendor/maatwebsite/excel/src/Concerns/WithConditionalSheets.php
vendored
Normal file
37
vendor/maatwebsite/excel/src/Concerns/WithConditionalSheets.php
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
trait WithConditionalSheets
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $conditionallySelectedSheets = [];
|
||||
|
||||
/**
|
||||
* @param string|array $sheets
|
||||
* @return $this
|
||||
*/
|
||||
public function onlySheets($sheets)
|
||||
{
|
||||
$this->conditionallySelectedSheets = is_array($sheets) ? $sheets : func_get_args();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function sheets(): array
|
||||
{
|
||||
return \array_filter($this->conditionalSheets(), function ($name) {
|
||||
return \in_array($name, $this->conditionallySelectedSheets, false);
|
||||
}, ARRAY_FILTER_USE_KEY);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
abstract public function conditionalSheets(): array;
|
||||
}
|
||||
11
vendor/maatwebsite/excel/src/Concerns/WithCustomChunkSize.php
vendored
Normal file
11
vendor/maatwebsite/excel/src/Concerns/WithCustomChunkSize.php
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
interface WithCustomChunkSize
|
||||
{
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function chunkSize(): int;
|
||||
}
|
||||
11
vendor/maatwebsite/excel/src/Concerns/WithCustomCsvSettings.php
vendored
Normal file
11
vendor/maatwebsite/excel/src/Concerns/WithCustomCsvSettings.php
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
interface WithCustomCsvSettings
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getCsvSettings(): array;
|
||||
}
|
||||
17
vendor/maatwebsite/excel/src/Concerns/WithCustomQuerySize.php
vendored
Normal file
17
vendor/maatwebsite/excel/src/Concerns/WithCustomQuerySize.php
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
interface WithCustomQuerySize
|
||||
{
|
||||
/**
|
||||
* Queued exportables are processed in chunks; each chunk being a job pushed to the queue by the QueuedWriter.
|
||||
* In case of exportables that implement the FromQuery concern, the number of jobs is calculated by dividing the $query->count() by the chunk size.
|
||||
* Depending on the implementation of the query() method (eg. When using a groupBy clause), this calculation might not be correct.
|
||||
*
|
||||
* When this is the case, you should use this method to provide a custom calculation of the query size.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function querySize(): int;
|
||||
}
|
||||
11
vendor/maatwebsite/excel/src/Concerns/WithCustomStartCell.php
vendored
Normal file
11
vendor/maatwebsite/excel/src/Concerns/WithCustomStartCell.php
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
interface WithCustomStartCell
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function startCell(): string;
|
||||
}
|
||||
9
vendor/maatwebsite/excel/src/Concerns/WithCustomValueBinder.php
vendored
Normal file
9
vendor/maatwebsite/excel/src/Concerns/WithCustomValueBinder.php
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Cell\IValueBinder;
|
||||
|
||||
interface WithCustomValueBinder extends IValueBinder
|
||||
{
|
||||
}
|
||||
13
vendor/maatwebsite/excel/src/Concerns/WithDefaultStyles.php
vendored
Normal file
13
vendor/maatwebsite/excel/src/Concerns/WithDefaultStyles.php
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Style\Style;
|
||||
|
||||
interface WithDefaultStyles
|
||||
{
|
||||
/**
|
||||
* @return array|void
|
||||
*/
|
||||
public function defaultStyles(Style $defaultStyle);
|
||||
}
|
||||
13
vendor/maatwebsite/excel/src/Concerns/WithDrawings.php
vendored
Normal file
13
vendor/maatwebsite/excel/src/Concerns/WithDrawings.php
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Worksheet\BaseDrawing;
|
||||
|
||||
interface WithDrawings
|
||||
{
|
||||
/**
|
||||
* @return BaseDrawing|BaseDrawing[]
|
||||
*/
|
||||
public function drawings();
|
||||
}
|
||||
11
vendor/maatwebsite/excel/src/Concerns/WithEvents.php
vendored
Normal file
11
vendor/maatwebsite/excel/src/Concerns/WithEvents.php
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
interface WithEvents
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function registerEvents(): array;
|
||||
}
|
||||
7
vendor/maatwebsite/excel/src/Concerns/WithFormatData.php
vendored
Normal file
7
vendor/maatwebsite/excel/src/Concerns/WithFormatData.php
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
interface WithFormatData
|
||||
{
|
||||
}
|
||||
7
vendor/maatwebsite/excel/src/Concerns/WithGroupedHeadingRow.php
vendored
Normal file
7
vendor/maatwebsite/excel/src/Concerns/WithGroupedHeadingRow.php
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
interface WithGroupedHeadingRow extends WithHeadingRow
|
||||
{
|
||||
}
|
||||
7
vendor/maatwebsite/excel/src/Concerns/WithHeadingRow.php
vendored
Normal file
7
vendor/maatwebsite/excel/src/Concerns/WithHeadingRow.php
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
interface WithHeadingRow
|
||||
{
|
||||
}
|
||||
11
vendor/maatwebsite/excel/src/Concerns/WithHeadings.php
vendored
Normal file
11
vendor/maatwebsite/excel/src/Concerns/WithHeadings.php
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
interface WithHeadings
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function headings(): array;
|
||||
}
|
||||
11
vendor/maatwebsite/excel/src/Concerns/WithLimit.php
vendored
Normal file
11
vendor/maatwebsite/excel/src/Concerns/WithLimit.php
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
interface WithLimit
|
||||
{
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function limit(): int;
|
||||
}
|
||||
11
vendor/maatwebsite/excel/src/Concerns/WithMappedCells.php
vendored
Normal file
11
vendor/maatwebsite/excel/src/Concerns/WithMappedCells.php
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
interface WithMappedCells
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function mapping(): array;
|
||||
}
|
||||
12
vendor/maatwebsite/excel/src/Concerns/WithMapping.php
vendored
Normal file
12
vendor/maatwebsite/excel/src/Concerns/WithMapping.php
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
interface WithMapping
|
||||
{
|
||||
/**
|
||||
* @param mixed $row
|
||||
* @return array
|
||||
*/
|
||||
public function map($row): array;
|
||||
}
|
||||
11
vendor/maatwebsite/excel/src/Concerns/WithMultipleSheets.php
vendored
Normal file
11
vendor/maatwebsite/excel/src/Concerns/WithMultipleSheets.php
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
interface WithMultipleSheets
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function sheets(): array;
|
||||
}
|
||||
7
vendor/maatwebsite/excel/src/Concerns/WithPreCalculateFormulas.php
vendored
Normal file
7
vendor/maatwebsite/excel/src/Concerns/WithPreCalculateFormulas.php
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
interface WithPreCalculateFormulas
|
||||
{
|
||||
}
|
||||
13
vendor/maatwebsite/excel/src/Concerns/WithProgressBar.php
vendored
Normal file
13
vendor/maatwebsite/excel/src/Concerns/WithProgressBar.php
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
use Illuminate\Console\OutputStyle;
|
||||
|
||||
interface WithProgressBar
|
||||
{
|
||||
/**
|
||||
* @return OutputStyle
|
||||
*/
|
||||
public function getConsoleOutput(): OutputStyle;
|
||||
}
|
||||
8
vendor/maatwebsite/excel/src/Concerns/WithProperties.php
vendored
Normal file
8
vendor/maatwebsite/excel/src/Concerns/WithProperties.php
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
interface WithProperties
|
||||
{
|
||||
public function properties(): array;
|
||||
}
|
||||
13
vendor/maatwebsite/excel/src/Concerns/WithReadFilter.php
vendored
Normal file
13
vendor/maatwebsite/excel/src/Concerns/WithReadFilter.php
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Reader\IReadFilter;
|
||||
|
||||
interface WithReadFilter
|
||||
{
|
||||
/**
|
||||
* @return IReadFilter
|
||||
*/
|
||||
public function readFilter(): IReadFilter;
|
||||
}
|
||||
11
vendor/maatwebsite/excel/src/Concerns/WithStartRow.php
vendored
Normal file
11
vendor/maatwebsite/excel/src/Concerns/WithStartRow.php
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
interface WithStartRow
|
||||
{
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function startRow(): int;
|
||||
}
|
||||
7
vendor/maatwebsite/excel/src/Concerns/WithStrictNullComparison.php
vendored
Normal file
7
vendor/maatwebsite/excel/src/Concerns/WithStrictNullComparison.php
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
interface WithStrictNullComparison
|
||||
{
|
||||
}
|
||||
10
vendor/maatwebsite/excel/src/Concerns/WithStyles.php
vendored
Normal file
10
vendor/maatwebsite/excel/src/Concerns/WithStyles.php
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
||||
|
||||
interface WithStyles
|
||||
{
|
||||
public function styles(Worksheet $sheet);
|
||||
}
|
||||
11
vendor/maatwebsite/excel/src/Concerns/WithTitle.php
vendored
Normal file
11
vendor/maatwebsite/excel/src/Concerns/WithTitle.php
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
interface WithTitle
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function title(): string;
|
||||
}
|
||||
11
vendor/maatwebsite/excel/src/Concerns/WithUpsertColumns.php
vendored
Normal file
11
vendor/maatwebsite/excel/src/Concerns/WithUpsertColumns.php
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
interface WithUpsertColumns
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function upsertColumns();
|
||||
}
|
||||
11
vendor/maatwebsite/excel/src/Concerns/WithUpserts.php
vendored
Normal file
11
vendor/maatwebsite/excel/src/Concerns/WithUpserts.php
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
interface WithUpserts
|
||||
{
|
||||
/**
|
||||
* @return string|array
|
||||
*/
|
||||
public function uniqueBy();
|
||||
}
|
||||
11
vendor/maatwebsite/excel/src/Concerns/WithValidation.php
vendored
Normal file
11
vendor/maatwebsite/excel/src/Concerns/WithValidation.php
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
interface WithValidation
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function rules(): array;
|
||||
}
|
||||
93
vendor/maatwebsite/excel/src/Console/ExportMakeCommand.php
vendored
Normal file
93
vendor/maatwebsite/excel/src/Console/ExportMakeCommand.php
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Console;
|
||||
|
||||
use Illuminate\Console\GeneratorCommand;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
class ExportMakeCommand extends GeneratorCommand
|
||||
{
|
||||
use WithModelStub;
|
||||
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'make:export';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Create a new export class';
|
||||
|
||||
/**
|
||||
* The type of class being generated.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $type = 'Export';
|
||||
|
||||
/**
|
||||
* Get the stub file for the generator.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getStub()
|
||||
{
|
||||
if ($this->option('model') && $this->option('query')) {
|
||||
return $this->resolveStubPath('/stubs/export.query-model.stub');
|
||||
} elseif ($this->option('model')) {
|
||||
return $this->resolveStubPath('/stubs/export.model.stub');
|
||||
} elseif ($this->option('query')) {
|
||||
return $this->resolveStubPath('/stubs/export.query.stub');
|
||||
}
|
||||
|
||||
return $this->resolveStubPath('/stubs/export.plain.stub');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default namespace for the class.
|
||||
*
|
||||
* @param string $rootNamespace
|
||||
* @return string
|
||||
*/
|
||||
protected function getDefaultNamespace($rootNamespace)
|
||||
{
|
||||
return $rootNamespace . '\Exports';
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the class with the given name.
|
||||
* Remove the base controller import if we are already in base namespace.
|
||||
*
|
||||
* @param string $name
|
||||
* @return string
|
||||
*/
|
||||
protected function buildClass($name)
|
||||
{
|
||||
$replace = [];
|
||||
if ($this->option('model')) {
|
||||
$replace = $this->buildModelReplacements($replace);
|
||||
}
|
||||
|
||||
return str_replace(
|
||||
array_keys($replace), array_values($replace), parent::buildClass($name)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the console command options.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
return [
|
||||
['model', 'm', InputOption::VALUE_OPTIONAL, 'Generate an export for the given model.'],
|
||||
['query', '', InputOption::VALUE_NONE, 'Generate an export for a query.'],
|
||||
];
|
||||
}
|
||||
}
|
||||
86
vendor/maatwebsite/excel/src/Console/ImportMakeCommand.php
vendored
Normal file
86
vendor/maatwebsite/excel/src/Console/ImportMakeCommand.php
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Console;
|
||||
|
||||
use Illuminate\Console\GeneratorCommand;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
class ImportMakeCommand extends GeneratorCommand
|
||||
{
|
||||
use WithModelStub;
|
||||
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'make:import';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Create a new import class';
|
||||
|
||||
/**
|
||||
* The type of class being generated.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $type = 'Import';
|
||||
|
||||
/**
|
||||
* Get the stub file for the generator.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getStub()
|
||||
{
|
||||
return $this->option('model')
|
||||
? $this->resolveStubPath('/stubs/import.model.stub')
|
||||
: $this->resolveStubPath('/stubs/import.collection.stub');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default namespace for the class.
|
||||
*
|
||||
* @param string $rootNamespace
|
||||
* @return string
|
||||
*/
|
||||
protected function getDefaultNamespace($rootNamespace)
|
||||
{
|
||||
return $rootNamespace . '\Imports';
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the class with the given name.
|
||||
* Remove the base controller import if we are already in base namespace.
|
||||
*
|
||||
* @param string $name
|
||||
* @return string
|
||||
*/
|
||||
protected function buildClass($name)
|
||||
{
|
||||
$replace = [];
|
||||
if ($this->option('model')) {
|
||||
$replace = $this->buildModelReplacements($replace);
|
||||
}
|
||||
|
||||
return str_replace(
|
||||
array_keys($replace), array_values($replace), parent::buildClass($name)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the console command options.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
return [
|
||||
['model', 'm', InputOption::VALUE_OPTIONAL, 'Generate an import for the given model.'],
|
||||
];
|
||||
}
|
||||
}
|
||||
67
vendor/maatwebsite/excel/src/Console/WithModelStub.php
vendored
Normal file
67
vendor/maatwebsite/excel/src/Console/WithModelStub.php
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Console;
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
use InvalidArgumentException;
|
||||
|
||||
trait WithModelStub
|
||||
{
|
||||
/**
|
||||
* Build the model replacement values.
|
||||
*
|
||||
* @param array $replace
|
||||
* @return array
|
||||
*/
|
||||
protected function buildModelReplacements(array $replace): array
|
||||
{
|
||||
$modelClass = $this->parseModel($this->option('model'));
|
||||
|
||||
return array_merge($replace, [
|
||||
'DummyFullModelClass' => $modelClass,
|
||||
'DummyModelClass' => class_basename($modelClass),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the fully-qualified model class name.
|
||||
*
|
||||
* @param string $model
|
||||
* @return string
|
||||
*/
|
||||
protected function parseModel($model): string
|
||||
{
|
||||
if (preg_match('([^A-Za-z0-9_/\\\\])', $model)) {
|
||||
throw new InvalidArgumentException('Model name contains invalid characters.');
|
||||
}
|
||||
|
||||
$model = ltrim($model, '\\/');
|
||||
|
||||
$model = str_replace('/', '\\', $model);
|
||||
|
||||
$rootNamespace = $this->rootNamespace();
|
||||
|
||||
if (Str::startsWith($model, $rootNamespace)) {
|
||||
return $model;
|
||||
}
|
||||
|
||||
$model = is_dir(app_path('Models'))
|
||||
? $rootNamespace . 'Models\\' . $model
|
||||
: $rootNamespace . $model;
|
||||
|
||||
return $model;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve the fully-qualified path to the stub.
|
||||
*
|
||||
* @param string $stub
|
||||
* @return string
|
||||
*/
|
||||
protected function resolveStubPath($stub)
|
||||
{
|
||||
return file_exists($customPath = $this->laravel->basePath(trim($stub, '/')))
|
||||
? $customPath
|
||||
: __DIR__ . $stub;
|
||||
}
|
||||
}
|
||||
17
vendor/maatwebsite/excel/src/Console/stubs/export.model.stub
vendored
Normal file
17
vendor/maatwebsite/excel/src/Console/stubs/export.model.stub
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace DummyNamespace;
|
||||
|
||||
use DummyFullModelClass;
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
|
||||
class DummyClass implements FromCollection
|
||||
{
|
||||
/**
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
public function collection()
|
||||
{
|
||||
return DummyModelClass::all();
|
||||
}
|
||||
}
|
||||
16
vendor/maatwebsite/excel/src/Console/stubs/export.plain.stub
vendored
Normal file
16
vendor/maatwebsite/excel/src/Console/stubs/export.plain.stub
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace DummyNamespace;
|
||||
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
|
||||
class DummyClass implements FromCollection
|
||||
{
|
||||
/**
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
public function collection()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
17
vendor/maatwebsite/excel/src/Console/stubs/export.query-model.stub
vendored
Normal file
17
vendor/maatwebsite/excel/src/Console/stubs/export.query-model.stub
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace DummyNamespace;
|
||||
|
||||
use DummyFullModelClass;
|
||||
use Maatwebsite\Excel\Concerns\FromQuery;
|
||||
|
||||
class DummyClass implements FromQuery
|
||||
{
|
||||
/**
|
||||
* @return \Illuminate\Database\Query\Builder
|
||||
*/
|
||||
public function query()
|
||||
{
|
||||
return DummyModelClass::query();
|
||||
}
|
||||
}
|
||||
16
vendor/maatwebsite/excel/src/Console/stubs/export.query.stub
vendored
Normal file
16
vendor/maatwebsite/excel/src/Console/stubs/export.query.stub
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace DummyNamespace;
|
||||
|
||||
use Maatwebsite\Excel\Concerns\FromQuery;
|
||||
|
||||
class DummyClass implements FromQuery
|
||||
{
|
||||
/**
|
||||
* @return \Illuminate\Database\Query\Builder
|
||||
*/
|
||||
public function query()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
17
vendor/maatwebsite/excel/src/Console/stubs/import.collection.stub
vendored
Normal file
17
vendor/maatwebsite/excel/src/Console/stubs/import.collection.stub
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace DummyNamespace;
|
||||
|
||||
use Illuminate\Support\Collection;
|
||||
use Maatwebsite\Excel\Concerns\ToCollection;
|
||||
|
||||
class DummyClass implements ToCollection
|
||||
{
|
||||
/**
|
||||
* @param Collection $collection
|
||||
*/
|
||||
public function collection(Collection $collection)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
21
vendor/maatwebsite/excel/src/Console/stubs/import.model.stub
vendored
Normal file
21
vendor/maatwebsite/excel/src/Console/stubs/import.model.stub
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace DummyNamespace;
|
||||
|
||||
use DummyFullModelClass;
|
||||
use Maatwebsite\Excel\Concerns\ToModel;
|
||||
|
||||
class DummyClass implements ToModel
|
||||
{
|
||||
/**
|
||||
* @param array $row
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Model|null
|
||||
*/
|
||||
public function model(array $row)
|
||||
{
|
||||
return new DummyModelClass([
|
||||
//
|
||||
]);
|
||||
}
|
||||
}
|
||||
23
vendor/maatwebsite/excel/src/DefaultValueBinder.php
vendored
Normal file
23
vendor/maatwebsite/excel/src/DefaultValueBinder.php
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel;
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Cell\Cell;
|
||||
use PhpOffice\PhpSpreadsheet\Cell\DefaultValueBinder as PhpSpreadsheetDefaultValueBinder;
|
||||
|
||||
class DefaultValueBinder extends PhpSpreadsheetDefaultValueBinder
|
||||
{
|
||||
/**
|
||||
* @param Cell $cell Cell to bind value to
|
||||
* @param mixed $value Value to bind in cell
|
||||
* @return bool
|
||||
*/
|
||||
public function bindValue(Cell $cell, $value)
|
||||
{
|
||||
if (is_array($value)) {
|
||||
$value = \json_encode($value);
|
||||
}
|
||||
|
||||
return parent::bindValue($cell, $value);
|
||||
}
|
||||
}
|
||||
35
vendor/maatwebsite/excel/src/DelegatedMacroable.php
vendored
Normal file
35
vendor/maatwebsite/excel/src/DelegatedMacroable.php
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel;
|
||||
|
||||
use Illuminate\Support\Traits\Macroable;
|
||||
|
||||
trait DelegatedMacroable
|
||||
{
|
||||
use Macroable {
|
||||
__call as __callMacro;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dynamically handle calls to the class.
|
||||
*
|
||||
* @param string $method
|
||||
* @param array $parameters
|
||||
* @return mixed
|
||||
*/
|
||||
public function __call($method, $parameters)
|
||||
{
|
||||
if (method_exists($this->getDelegate(), $method)) {
|
||||
return call_user_func_array([$this->getDelegate(), $method], $parameters);
|
||||
}
|
||||
|
||||
array_unshift($parameters, $this);
|
||||
|
||||
return $this->__callMacro($method, $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return object
|
||||
*/
|
||||
abstract public function getDelegate();
|
||||
}
|
||||
52
vendor/maatwebsite/excel/src/Events/AfterImport.php
vendored
Normal file
52
vendor/maatwebsite/excel/src/Events/AfterImport.php
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Events;
|
||||
|
||||
use Maatwebsite\Excel\Reader;
|
||||
|
||||
class AfterImport extends Event
|
||||
{
|
||||
/**
|
||||
* @var Reader
|
||||
*/
|
||||
public $reader;
|
||||
|
||||
/**
|
||||
* @var object
|
||||
*/
|
||||
private $importable;
|
||||
|
||||
/**
|
||||
* @param Reader $reader
|
||||
* @param object $importable
|
||||
*/
|
||||
public function __construct(Reader $reader, $importable)
|
||||
{
|
||||
$this->reader = $reader;
|
||||
$this->importable = $importable;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Reader
|
||||
*/
|
||||
public function getReader(): Reader
|
||||
{
|
||||
return $this->reader;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return object
|
||||
*/
|
||||
public function getConcernable()
|
||||
{
|
||||
return $this->importable;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getDelegate()
|
||||
{
|
||||
return $this->reader;
|
||||
}
|
||||
}
|
||||
52
vendor/maatwebsite/excel/src/Events/AfterSheet.php
vendored
Normal file
52
vendor/maatwebsite/excel/src/Events/AfterSheet.php
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Events;
|
||||
|
||||
use Maatwebsite\Excel\Sheet;
|
||||
|
||||
class AfterSheet extends Event
|
||||
{
|
||||
/**
|
||||
* @var Sheet
|
||||
*/
|
||||
public $sheet;
|
||||
|
||||
/**
|
||||
* @var object
|
||||
*/
|
||||
private $exportable;
|
||||
|
||||
/**
|
||||
* @param Sheet $sheet
|
||||
* @param object $exportable
|
||||
*/
|
||||
public function __construct(Sheet $sheet, $exportable)
|
||||
{
|
||||
$this->sheet = $sheet;
|
||||
$this->exportable = $exportable;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Sheet
|
||||
*/
|
||||
public function getSheet(): Sheet
|
||||
{
|
||||
return $this->sheet;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return object
|
||||
*/
|
||||
public function getConcernable()
|
||||
{
|
||||
return $this->exportable;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getDelegate()
|
||||
{
|
||||
return $this->sheet;
|
||||
}
|
||||
}
|
||||
52
vendor/maatwebsite/excel/src/Events/BeforeExport.php
vendored
Normal file
52
vendor/maatwebsite/excel/src/Events/BeforeExport.php
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Events;
|
||||
|
||||
use Maatwebsite\Excel\Writer;
|
||||
|
||||
class BeforeExport extends Event
|
||||
{
|
||||
/**
|
||||
* @var Writer
|
||||
*/
|
||||
public $writer;
|
||||
|
||||
/**
|
||||
* @var object
|
||||
*/
|
||||
private $exportable;
|
||||
|
||||
/**
|
||||
* @param Writer $writer
|
||||
* @param object $exportable
|
||||
*/
|
||||
public function __construct(Writer $writer, $exportable)
|
||||
{
|
||||
$this->writer = $writer;
|
||||
$this->exportable = $exportable;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Writer
|
||||
*/
|
||||
public function getWriter(): Writer
|
||||
{
|
||||
return $this->writer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return object
|
||||
*/
|
||||
public function getConcernable()
|
||||
{
|
||||
return $this->exportable;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getDelegate()
|
||||
{
|
||||
return $this->writer;
|
||||
}
|
||||
}
|
||||
52
vendor/maatwebsite/excel/src/Events/BeforeImport.php
vendored
Normal file
52
vendor/maatwebsite/excel/src/Events/BeforeImport.php
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Events;
|
||||
|
||||
use Maatwebsite\Excel\Reader;
|
||||
|
||||
class BeforeImport extends Event
|
||||
{
|
||||
/**
|
||||
* @var Reader
|
||||
*/
|
||||
public $reader;
|
||||
|
||||
/**
|
||||
* @var object
|
||||
*/
|
||||
private $importable;
|
||||
|
||||
/**
|
||||
* @param Reader $reader
|
||||
* @param object $importable
|
||||
*/
|
||||
public function __construct(Reader $reader, $importable)
|
||||
{
|
||||
$this->reader = $reader;
|
||||
$this->importable = $importable;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Reader
|
||||
*/
|
||||
public function getReader(): Reader
|
||||
{
|
||||
return $this->reader;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return object
|
||||
*/
|
||||
public function getConcernable()
|
||||
{
|
||||
return $this->importable;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getDelegate()
|
||||
{
|
||||
return $this->reader;
|
||||
}
|
||||
}
|
||||
52
vendor/maatwebsite/excel/src/Events/BeforeSheet.php
vendored
Normal file
52
vendor/maatwebsite/excel/src/Events/BeforeSheet.php
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Events;
|
||||
|
||||
use Maatwebsite\Excel\Sheet;
|
||||
|
||||
class BeforeSheet extends Event
|
||||
{
|
||||
/**
|
||||
* @var Sheet
|
||||
*/
|
||||
public $sheet;
|
||||
|
||||
/**
|
||||
* @var object
|
||||
*/
|
||||
private $exportable;
|
||||
|
||||
/**
|
||||
* @param Sheet $sheet
|
||||
* @param object $exportable
|
||||
*/
|
||||
public function __construct(Sheet $sheet, $exportable)
|
||||
{
|
||||
$this->sheet = $sheet;
|
||||
$this->exportable = $exportable;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Sheet
|
||||
*/
|
||||
public function getSheet(): Sheet
|
||||
{
|
||||
return $this->sheet;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return object
|
||||
*/
|
||||
public function getConcernable()
|
||||
{
|
||||
return $this->exportable;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getDelegate()
|
||||
{
|
||||
return $this->sheet;
|
||||
}
|
||||
}
|
||||
52
vendor/maatwebsite/excel/src/Events/BeforeWriting.php
vendored
Normal file
52
vendor/maatwebsite/excel/src/Events/BeforeWriting.php
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Events;
|
||||
|
||||
use Maatwebsite\Excel\Writer;
|
||||
|
||||
class BeforeWriting extends Event
|
||||
{
|
||||
/**
|
||||
* @var Writer
|
||||
*/
|
||||
public $writer;
|
||||
|
||||
/**
|
||||
* @var object
|
||||
*/
|
||||
private $exportable;
|
||||
|
||||
/**
|
||||
* @param Writer $writer
|
||||
* @param object $exportable
|
||||
*/
|
||||
public function __construct(Writer $writer, $exportable)
|
||||
{
|
||||
$this->writer = $writer;
|
||||
$this->exportable = $exportable;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Writer
|
||||
*/
|
||||
public function getWriter(): Writer
|
||||
{
|
||||
return $this->writer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return object
|
||||
*/
|
||||
public function getConcernable()
|
||||
{
|
||||
return $this->exportable;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getDelegate()
|
||||
{
|
||||
return $this->writer;
|
||||
}
|
||||
}
|
||||
25
vendor/maatwebsite/excel/src/Events/Event.php
vendored
Normal file
25
vendor/maatwebsite/excel/src/Events/Event.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Events;
|
||||
|
||||
abstract class Event
|
||||
{
|
||||
/**
|
||||
* @return object
|
||||
*/
|
||||
abstract public function getConcernable();
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
abstract public function getDelegate();
|
||||
|
||||
/**
|
||||
* @param string $concern
|
||||
* @return bool
|
||||
*/
|
||||
public function appliesToConcern(string $concern): bool
|
||||
{
|
||||
return $this->getConcernable() instanceof $concern;
|
||||
}
|
||||
}
|
||||
29
vendor/maatwebsite/excel/src/Events/ImportFailed.php
vendored
Normal file
29
vendor/maatwebsite/excel/src/Events/ImportFailed.php
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Events;
|
||||
|
||||
use Throwable;
|
||||
|
||||
class ImportFailed
|
||||
{
|
||||
/**
|
||||
* @var Throwable
|
||||
*/
|
||||
public $e;
|
||||
|
||||
/**
|
||||
* @param Throwable $e
|
||||
*/
|
||||
public function __construct(Throwable $e)
|
||||
{
|
||||
$this->e = $e;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Throwable
|
||||
*/
|
||||
public function getException(): Throwable
|
||||
{
|
||||
return $this->e;
|
||||
}
|
||||
}
|
||||
197
vendor/maatwebsite/excel/src/Excel.php
vendored
Normal file
197
vendor/maatwebsite/excel/src/Excel.php
vendored
Normal file
@@ -0,0 +1,197 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel;
|
||||
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\PendingDispatch;
|
||||
use Illuminate\Support\Collection;
|
||||
use Maatwebsite\Excel\Files\Filesystem;
|
||||
use Maatwebsite\Excel\Files\TemporaryFile;
|
||||
use Maatwebsite\Excel\Helpers\FileTypeDetector;
|
||||
|
||||
class Excel implements Exporter, Importer
|
||||
{
|
||||
use RegistersCustomConcerns;
|
||||
|
||||
const XLSX = 'Xlsx';
|
||||
|
||||
const CSV = 'Csv';
|
||||
|
||||
const TSV = 'Csv';
|
||||
|
||||
const ODS = 'Ods';
|
||||
|
||||
const XLS = 'Xls';
|
||||
|
||||
const SLK = 'Slk';
|
||||
|
||||
const XML = 'Xml';
|
||||
|
||||
const GNUMERIC = 'Gnumeric';
|
||||
|
||||
const HTML = 'Html';
|
||||
|
||||
const MPDF = 'Mpdf';
|
||||
|
||||
const DOMPDF = 'Dompdf';
|
||||
|
||||
const TCPDF = 'Tcpdf';
|
||||
|
||||
/**
|
||||
* @var Writer
|
||||
*/
|
||||
protected $writer;
|
||||
|
||||
/**
|
||||
* @var QueuedWriter
|
||||
*/
|
||||
protected $queuedWriter;
|
||||
|
||||
/**
|
||||
* @var Filesystem
|
||||
*/
|
||||
protected $filesystem;
|
||||
|
||||
/**
|
||||
* @var Reader
|
||||
*/
|
||||
private $reader;
|
||||
|
||||
/**
|
||||
* @param Writer $writer
|
||||
* @param QueuedWriter $queuedWriter
|
||||
* @param Reader $reader
|
||||
* @param Filesystem $filesystem
|
||||
*/
|
||||
public function __construct(
|
||||
Writer $writer,
|
||||
QueuedWriter $queuedWriter,
|
||||
Reader $reader,
|
||||
Filesystem $filesystem
|
||||
) {
|
||||
$this->writer = $writer;
|
||||
$this->reader = $reader;
|
||||
$this->filesystem = $filesystem;
|
||||
$this->queuedWriter = $queuedWriter;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function download($export, string $fileName, string $writerType = null, array $headers = [])
|
||||
{
|
||||
return response()->download(
|
||||
$this->export($export, $fileName, $writerType)->getLocalPath(),
|
||||
$fileName,
|
||||
$headers
|
||||
)->deleteFileAfterSend(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function store($export, string $filePath, string $diskName = null, string $writerType = null, $diskOptions = [])
|
||||
{
|
||||
if ($export instanceof ShouldQueue) {
|
||||
return $this->queue($export, $filePath, $diskName, $writerType, $diskOptions);
|
||||
}
|
||||
|
||||
$temporaryFile = $this->export($export, $filePath, $writerType);
|
||||
|
||||
$exported = $this->filesystem->disk($diskName, $diskOptions)->copy(
|
||||
$temporaryFile,
|
||||
$filePath
|
||||
);
|
||||
|
||||
$temporaryFile->delete();
|
||||
|
||||
return $exported;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function queue($export, string $filePath, string $disk = null, string $writerType = null, $diskOptions = [])
|
||||
{
|
||||
$writerType = FileTypeDetector::detectStrict($filePath, $writerType);
|
||||
|
||||
return $this->queuedWriter->store(
|
||||
$export,
|
||||
$filePath,
|
||||
$disk,
|
||||
$writerType,
|
||||
$diskOptions
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function raw($export, string $writerType)
|
||||
{
|
||||
$temporaryFile = $this->writer->export($export, $writerType);
|
||||
|
||||
$contents = $temporaryFile->contents();
|
||||
$temporaryFile->delete();
|
||||
|
||||
return $contents;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function import($import, $filePath, string $disk = null, string $readerType = null)
|
||||
{
|
||||
$readerType = FileTypeDetector::detect($filePath, $readerType);
|
||||
$response = $this->reader->read($import, $filePath, $readerType, $disk);
|
||||
|
||||
if ($response instanceof PendingDispatch) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function toArray($import, $filePath, string $disk = null, string $readerType = null): array
|
||||
{
|
||||
$readerType = FileTypeDetector::detect($filePath, $readerType);
|
||||
|
||||
return $this->reader->toArray($import, $filePath, $readerType, $disk);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function toCollection($import, $filePath, string $disk = null, string $readerType = null): Collection
|
||||
{
|
||||
$readerType = FileTypeDetector::detect($filePath, $readerType);
|
||||
|
||||
return $this->reader->toCollection($import, $filePath, $readerType, $disk);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function queueImport(ShouldQueue $import, $filePath, string $disk = null, string $readerType = null)
|
||||
{
|
||||
return $this->import($import, $filePath, $disk, $readerType);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object $export
|
||||
* @param string|null $fileName
|
||||
* @param string $writerType
|
||||
* @return TemporaryFile
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*/
|
||||
protected function export($export, string $fileName, string $writerType = null): TemporaryFile
|
||||
{
|
||||
$writerType = FileTypeDetector::detectStrict($fileName, $writerType);
|
||||
|
||||
return $this->writer->export($export, $writerType);
|
||||
}
|
||||
}
|
||||
117
vendor/maatwebsite/excel/src/ExcelServiceProvider.php
vendored
Normal file
117
vendor/maatwebsite/excel/src/ExcelServiceProvider.php
vendored
Normal file
@@ -0,0 +1,117 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel;
|
||||
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Laravel\Lumen\Application as LumenApplication;
|
||||
use Maatwebsite\Excel\Cache\CacheManager;
|
||||
use Maatwebsite\Excel\Console\ExportMakeCommand;
|
||||
use Maatwebsite\Excel\Console\ImportMakeCommand;
|
||||
use Maatwebsite\Excel\Files\Filesystem;
|
||||
use Maatwebsite\Excel\Files\TemporaryFileFactory;
|
||||
use Maatwebsite\Excel\Mixins\DownloadCollection;
|
||||
use Maatwebsite\Excel\Mixins\StoreCollection;
|
||||
use Maatwebsite\Excel\Transactions\TransactionHandler;
|
||||
use Maatwebsite\Excel\Transactions\TransactionManager;
|
||||
|
||||
class ExcelServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
if ($this->app->runningInConsole()) {
|
||||
$this->publishes([
|
||||
__DIR__ . '/Console/stubs/export.model.stub' => base_path('stubs/export.model.stub'),
|
||||
__DIR__ . '/Console/stubs/export.plain.stub' => base_path('stubs/export.plain.stub'),
|
||||
__DIR__ . '/Console/stubs/export.query.stub' => base_path('stubs/export.query.stub'),
|
||||
__DIR__ . '/Console/stubs/export.query-model.stub' => base_path('stubs/export.query-model.stub'),
|
||||
__DIR__ . '/Console/stubs/import.collection.stub' => base_path('stubs/import.collection.stub'),
|
||||
__DIR__ . '/Console/stubs/import.model.stub' => base_path('stubs/import.model.stub'),
|
||||
], 'stubs');
|
||||
|
||||
if ($this->app instanceof LumenApplication) {
|
||||
$this->app->configure('excel');
|
||||
} else {
|
||||
$this->publishes([
|
||||
$this->getConfigFile() => config_path('excel.php'),
|
||||
], 'config');
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->app instanceof \Illuminate\Foundation\Application) {
|
||||
// Laravel
|
||||
$this->app->booted(function ($app) {
|
||||
$app->make(SettingsProvider::class)->provide();
|
||||
});
|
||||
} else {
|
||||
// Lumen
|
||||
$this->app->make(SettingsProvider::class)->provide();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->mergeConfigFrom(
|
||||
$this->getConfigFile(),
|
||||
'excel'
|
||||
);
|
||||
|
||||
$this->app->bind(CacheManager::class, function ($app) {
|
||||
return new CacheManager($app);
|
||||
});
|
||||
|
||||
$this->app->singleton(TransactionManager::class, function ($app) {
|
||||
return new TransactionManager($app);
|
||||
});
|
||||
|
||||
$this->app->bind(TransactionHandler::class, function ($app) {
|
||||
return $app->make(TransactionManager::class)->driver();
|
||||
});
|
||||
|
||||
$this->app->bind(TemporaryFileFactory::class, function () {
|
||||
return new TemporaryFileFactory(
|
||||
config('excel.temporary_files.local_path', config('excel.exports.temp_path', storage_path('framework/laravel-excel'))),
|
||||
config('excel.temporary_files.remote_disk')
|
||||
);
|
||||
});
|
||||
|
||||
$this->app->bind(Filesystem::class, function ($app) {
|
||||
return new Filesystem($app->make('filesystem'));
|
||||
});
|
||||
|
||||
$this->app->bind('excel', function ($app) {
|
||||
return new Excel(
|
||||
$app->make(Writer::class),
|
||||
$app->make(QueuedWriter::class),
|
||||
$app->make(Reader::class),
|
||||
$app->make(Filesystem::class)
|
||||
);
|
||||
});
|
||||
|
||||
$this->app->alias('excel', Excel::class);
|
||||
$this->app->alias('excel', Exporter::class);
|
||||
$this->app->alias('excel', Importer::class);
|
||||
|
||||
Collection::mixin(new DownloadCollection);
|
||||
Collection::mixin(new StoreCollection);
|
||||
|
||||
$this->commands([
|
||||
ExportMakeCommand::class,
|
||||
ImportMakeCommand::class,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected function getConfigFile(): string
|
||||
{
|
||||
return __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'excel.php';
|
||||
}
|
||||
}
|
||||
16
vendor/maatwebsite/excel/src/Exceptions/ConcernConflictException.php
vendored
Normal file
16
vendor/maatwebsite/excel/src/Exceptions/ConcernConflictException.php
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Exceptions;
|
||||
|
||||
use LogicException;
|
||||
|
||||
class ConcernConflictException extends LogicException implements LaravelExcelException
|
||||
{
|
||||
/**
|
||||
* @return ConcernConflictException
|
||||
*/
|
||||
public static function queryOrCollectionAndView()
|
||||
{
|
||||
return new static('Cannot use FromQuery, FromArray or FromCollection and FromView on the same sheet.');
|
||||
}
|
||||
}
|
||||
9
vendor/maatwebsite/excel/src/Exceptions/LaravelExcelException.php
vendored
Normal file
9
vendor/maatwebsite/excel/src/Exceptions/LaravelExcelException.php
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Exceptions;
|
||||
|
||||
use Throwable;
|
||||
|
||||
interface LaravelExcelException extends Throwable
|
||||
{
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user