Файловый менеджер - Редактировать - /home/clickysoft/public_html/jmapi5.clickysoft.net/yajra.tar
Назад
laravel-datatables-oracle/UPGRADE.md 0000644 00000001306 15021222520 0013137 0 ustar 00 ## Upgrading from v6.x to v7.x - composer require yajra/laravel-datatables-oracle - composer require yajra/laravel-datatables-buttons - php artisan vendor:publish --tag=datatables --force - php artisan vendor:publish --tag=datatables-buttons --force ## Upgrading from v5.x to v6.x - Change all occurrences of `yajra\Datatables` to `Yajra\Datatables`. (Use Sublime's find and replace all for faster update). - Remove `Datatables` facade registration. - Temporarily comment out `Yajra\Datatables\DatatablesServiceProvider`. - Update package version on your composer.json and use `yajra/laravel-datatables-oracle: ~6.0` - Uncomment the provider `Yajra\Datatables\DatatablesServiceProvider`. laravel-datatables-oracle/phpunit.xml.dist 0000644 00000001035 15021222520 0014700 0 ustar 00 <?xml version="1.0" encoding="UTF-8"?> <phpunit backupGlobals="false" backupStaticAttributes="false" bootstrap="vendor/autoload.php" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" > <testsuites> <testsuite name="Package Test Suite"> <directory suffix=".php">./tests/</directory> </testsuite> </testsuites> </phpunit> laravel-datatables-oracle/.styleci.yml 0000644 00000000216 15021222520 0014002 0 ustar 00 preset: laravel enabled: - align_double_arrow - align_equals - no_useless_else disabled: - concat_without_spaces - unalign_equals laravel-datatables-oracle/composer.json 0000644 00000003222 15021222520 0014247 0 ustar 00 { "name": "yajra/laravel-datatables-oracle", "description": "jQuery DataTables API for Laravel 5|6|7|8|9", "keywords": [ "laravel", "dataTables", "jquery" ], "license": "MIT", "authors": [ { "name": "Arjay Angeles", "email": "aqangeles@gmail.com" } ], "require": { "php": "^7.1.3|^8", "illuminate/database": "5.8.*|^6|^7|^8|^9", "illuminate/filesystem": "5.8.*|^6|^7|^8|^9", "illuminate/http": "5.8.*|^6|^7|^8|^9", "illuminate/support": "5.8.*|^6|^7|^8|^9", "illuminate/view": "5.8.*|^6|^7|^8|^9" }, "require-dev": { "orchestra/testbench": "^3.8|^4.0|^5.0|^6.0|^7.0" }, "suggest": { "yajra/laravel-datatables-buttons": "Plugin for server-side exporting of dataTables.", "yajra/laravel-datatables-html": "Plugin for server-side HTML builder of dataTables.", "yajra/laravel-datatables-fractal": "Plugin for server-side response using Fractal.", "yajra/laravel-datatables-editor": "Plugin to use DataTables Editor (requires a license)." }, "autoload": { "psr-4": { "Yajra\\DataTables\\": "src/" }, "files": [ "src/helper.php" ] }, "autoload-dev": { "psr-4": { "Yajra\\DataTables\\Tests\\": "tests/" } }, "extra": { "branch-alias": { "dev-master": "9.0-dev" }, "laravel": { "providers": [ "Yajra\\DataTables\\DataTablesServiceProvider" ], "aliases": { "DataTables": "Yajra\\DataTables\\Facades\\DataTables" } } }, "config": { "sort-packages": true }, "scripts": { "test": "vendor/bin/phpunit" }, "minimum-stability": "dev", "prefer-stable": true } laravel-datatables-oracle/CHANGELOG.md 0000644 00000076360 15021222520 0013353 0 ustar 00 # Laravel DataTables CHANGELOG [](https://packagist.org/packages/yajra/laravel-datatables-oracle) [](https://packagist.org/packages/yajra/laravel-datatables-oracle) [](https://travis-ci.org/yajra/laravel-datatables) [](https://packagist.org/packages/yajra/laravel-datatables-oracle) [](https://packagist.org/packages/yajra/laravel-datatables-oracle) ### [Unreleased] ### [v9.21.2] - 2022-07-12 - Fix HasOneThrough (added tests) #2816 - Fix #2738 ### [v9.21.1] - 2022-06-22 - Fix sorting and pagination on empty records #2803 ### [v9.21.0] - 2022-06-21 - Add support for dependency injection when using closure. #2521 ### [v9.20.0] - 2022-05-09 - Added orthogonal sort and filter for collection #2380 ### [v9.19.2] - 2022-04-07 - Changed PHPDocs to have the most specific class as their super return type #2771 ### [v9.19.1] - 2022-03-05 - Fix Formatter::format() doc block. - Fix `are` Word in Description #2743 - Update README #2735 ### [v9.19.0] - 2022-01-18 - Support for Laravel 9 #2727 - Don't trash the exception stack trace (#2714) #2724 ### [v9.18.2] - 2021-06-28 - Return empty string for null request keyword #2700 ### [v9.18.1] - 2021-06-28 - Query with subqueries exception fix. #2642 ### [v9.18.0] - 2021-04-16 - Improve count performance for simple queries. #2616 - Fixes #1928 - Make prepareCountQuery() public so its easy to test. ### [v9.17.4] - 2021-04-15 - Revert changes on count. #2614 - Fix #2613 - Reverts: #2611 and #2612 ### [v9.17.3] - 2021-04-14 - Fix the regression when using a having condition in a query. #2612 - Fix #1928 - Code cleanup in QueryDataTable class #2606 ### [v9.17.2] - 2021-04-12 - Remove unnecessary wrap to avoid performance issues #2608. - Fixes #1928. ### [v9.17.1] - 2021-03-23 - Fix morph relation support with multi level relations. #2588 #2590 - Fix tests and doc blocks. #2586 - Fixes #2587, #2589, #2580 ### [v9.17.0] - 2021-03-19 - feat(relations): add partial polymorphic support [#2580] ### [v9.16.0] - 2021-03-19 - Add set multi term on runtime [#2585] ### [v9.15.2] - 2020-12-04 - Remove raw sql when using regex and wrap the column name. ### [v9.15.1] - 2020-12-03 - Fix search pane builder instance when using eloquent. [#2540] ### [v9.15.0] - 2020-11-28 - PHP8 support [#2536] ### [v9.14.2] - 2020-11-27 - Fix PHP8 error, method exists now throws an exception if the first argument is not string|object [#2535] - Fixes [#2534] ### [v9.14.1] - 2020-11-11 - Fix resolution of custom search pane query builder. [#2513] ### [v9.14.0] - 2020-11-03 - Add column formatter. [#2193] - Fix [yajra/laravel-datatables-editor#33](https://github.com/yajra/laravel-datatables-editor/issues/33) ### [v9.13.0] - 2020-10-31 - Add support for search panes. [#2475] - Fix [#2463], [#2471] ### [v9.12.0] - 2020-10-31 - Add disable ordering via orderColumn. [#2481], credits to [@gredimano] - Fix [#1953] ### [v9.11.1] - 2020-10-06 - Use simple numeric sorting when dealing with numeric values [#2478], credits to [@miken32] - Fix [#1934]. ### [v9.11.0] - 2020-09-09 - Add support for Laravel 8. [#2457] by [@lloricode] ### [v9.10.2] - 2020-06-17 - Escape row in data processor also accepts Htmlable [#2414], credits to [@edwwaarrdd]. ### [v9.10.1] - 2020-05-30 - Fix type casting issue [#2399], credits to [@ehsanrasta]. - Fix [#1975] , [#1747]. - Fix issue with non-existing variables/attributes on Collection. [#2391], credits to [@mgralikowski]. - Add laravel missing versions on every docs [#2382], credits to [@lloricode]. ### [v9.10.0] - 2020-04-23 - Add support for HasOneThrough [#2368], credits to [@warlof] ### [v9.9.0] - 2020-03-04 - Support Laravel 7 [#2332], credits to [@barryvdh]. ### [v9.8.0] - 2019-12-17 - Add the possibility to makeVisible() some attribute of a model. [#2263], credits to [@imTigger]. ### [v9.7.2] - 2019-11-11 - Cast database engines to array. [#2240], credits to [@mtvbrianking]. - Fix [#2202]. ### [v9.7.1] - 2019-10-02 - Fix skipTotalRecords api not working on initial state. [#2222] ### [v9.7.0] - 2019-10-02 - Allow orderColumn using closure. [#2199] ### [v9.6.1] - 2019-09-26 - Improve orderByNullsLast SQL generation. [#2191] - Fix [#1822], [#1738]. ### [v9.6.0] - 2019-09-04 - Fix deprecated helper functions, then add support for Laravel 6. [#2171], credits to [@lloricode] - Fix [#2156]. ### [v9.5.0] - 2019-08-31 - Add support for startsWithSearch filter. [#2163] - Fix [#2161]. ### [v9.4.1] - 2019-06-12 - Removal of redundant SoftDelete check. [#2103], credits to [@selecod] ### [v9.4.0] - 2019-06-06 - Allow column search on blacklisted columns with custom filter. [#2102], fix [#2091]. - Enable the dotted notation in the ->only() function. [#2084], credits to [@Arkhas] - Add tests. ### [v9.3.0] - 2019-05-21 - Prevent malformed UTF-8 characters in debug mode. [#2088], credits to [@drsdre]. - Add the possibility to makeHidden() some attribute of a model. [#2085], credits to [@Arkhas]. ### [v9.2.0] - 2019-05-09 - Enable the dotted notation in the ->removeColumn() function. [#2082], credits to [@Arkhas]. - Consider black listed columns on column search. [#2079], credits to [@apreiml]. - Using predefined offsets for API-driven server-side(ish) DataTables. [#2083], credits to [@Stokoe0990]. ### [v9.1.1] - 2019-04-25 - Revert [#2051], fix [#2058]. [#2072]. ### [v9.1.0] - 2019-04-24 #### FIXED - Fix rendering column from blade file. [#2067], credits to [@lukchojnicki]. - Fix [#2045], [#2054], [#2024], [#1977], [#880], [#577], [#522], etc. #### ADDED - Add support for self join relationships. [#2051], credits to [@Morinohtar]. ### [v9.0.1] - 2019-03-26 - Allow boolean values for column[i].searchable [#1813], credits to [@sgotre]. ### [v9.0.0] - 2019-02-27 - Add support for Laravel 5.8 [#2002]. - Fix [#2001], [#2003]. - Drop support for lower version of dataTables. - Bump to php ^7.1.3. - Bump testbench to ^3.8. ### [v8.13.5] - 2019-02-13 - Keep select bindings option. [#1988], credits to [@royduin]. - Fix [#1983]. ### [v8.13.4] - 2019-01-29 - Added optional merge of config raw columns to rawColumns method. [#1960], credits to [@Spodnet] ### [v8.13.3] - 2019-01-05 - Revert [#1942]. - Fix [#1951]. ### [v8.13.2] - 2019-01-04 - Keep casted attributes. [#1942], credits to [@ridaamirini]. - Fix [#1747]. ### [v8.13.1] - 2018-11-23 - Revert v8.12.0 changes. ### [v8.13.0] - 2018-11-23 - Only escape callable output of add and edit column. [#1852], credits to [@sharifzadesina] - Fix adding of index column bug introduced by [#1852]. [#1915] - Add tests for [#1852]. ### [v8.12.0] - 2018-11-23 - Skipped, bad tagging! ### [v8.11.0] - 2018-11-20 - Use skipTotalRecords as it better describe what the function does. [#1912] - Remove method `simplePagination` and use `skipTotalRecords` instead. ### [v8.10.0] - 2018-11-20 - Add simple pagination api. [#1911] - Use `toJson()` on all tests api. [#1911] - Use dedicated assertCount assertion. [#1903], credits to [@carusogabriel] ### [v8.9.2] - 2018-10-30 - Fix the default name of index column to follow DT syntax. [#1882], credits to [@sharifzadesina]. ### [v8.9.1] - 2018-10-05 - DATATABLES_ERROR shouldn't be by default null [#1805] [#1811], credits to [@zeyad82]. ### [v8.9.0] - 2018-10-05 - Added ability to pass an array of needed columns on response. [#1860], credits to [@ptuchik]. ### [v8.8.0] - 2018-09-05 - Add support for Laravel 5.7 - Fix [#1824], [#1830] ### [v8.7.1] - 2018-07-06 - Add validation for order direction. [#1792] - Prevents SQL injection on order direction. - Fix phpunit configuration warning. ### [v8.7.0] - 2018-06-03 - Add withQuery api for query callback. [#1759] - Revert [#1758] with callback implementation since its BC. ### [v8.6.1] - 2018-06-03 - Fix/Enhance with closure value implementation. [#1758] - Use filteredQuery as callback parameter. - Fix [#1752] ### [v8.6.0] - 2018-05-18 - Add support for manual setting of filtered count [#1743], credits to [@forgottencreature] - Fix [#1516]. ### [v8.5.2] - 2018-05-15 - Revert "[8.0] Classify join statements as a complex query." [#1741] - Fix [#1739] ### [v8.5.1] - 2018-05-12 - Reset select bindings for count query [#1730], credits to [@fschalkwijk] - Classify join statements as a complex query [#1737]. - Fix [#1600], [#1471]. ### [v8.5.0] - 2018-05-10 - Support for Eloquent API Resources [#1702], credits to [@asahasrabuddhe]. - Fixes [#1515], [#1659], [#1351]. ### [v8.4.4] - 2018-05-04 - Use array_key_exists instead of in_array + array_keys [#1719], credits to [@carusogabriel]. - Adds support to Laravel 5.6 on readme, [#1724], credits to [@nunomaduro] - Fixed a bug for "undefined index" errors, [#1728], credits to [@redelschaap] ### [v8.4.3] - 2018-04-05 - [8.0] Fix ambiguous column 'deleted_at'. [#1688], credits to [@sskl]. ### [v8.4.2] - 2018-03-29 - Check SoftDeletes on HasOne or BelongsTo relations [#1628], credits to [@drahosistvan]. - Add mention of Datatables Editor pkg to "suggests" [#1658], credits to [@drbyte]. ### [v8.4.1] - 2018-02-16 - Change Log contract to LoggerInterface. [#1624], credits to [@LEI]. - Fix [#1626]. ### [v8.4.0] - 2018-02-11 - Added Laravel 5.6 Support [#1609], credits to [@marcoocram] - Fix [#1617] ### [v8.3.3] - 2018-01-11 - Fixes from PHPStan. [#1569], credits to [@carusogabriel]. - Enable no_useless_else. [#1554], credits to [@carusogabriel]. - Remove useless else statements. [#1553], credits to [@carusogabriel]. - Fix typo. [#1536], credits to [@Oussama-Tn]. - Test against PHP 7.2. [#1532], credits to [@carusogabriel]. - Update TestCase with PSR-2. [#1496], credits to [@gabriel-caruso]. ### [v8.3.2] - 2017-11-02 - Fix datatables() helper and use singleton instance. [#1487], credits to [@ElfSundae]. - Styling phpdoc for facade. [#1489], credits to [@ElfSundae]. - Apply StyleCI fixes. [#1485], [#1483]. - Patch docs. [#1492] - Add StyleCI integration. [#1484] ### [v8.3.1] - 2017-10-27 - Fix filtered records total when using filterColumn. [#1473], credits to [@wuwx](https://github.com/wuwx). - Added Patreon Link. [#1476], credits to [@ChaosPower](https://github.com/ChaosPower). - Fix missing periods. [#1478], credits to [@jiwom]. - Fix PHP Docs and minor array fixes. Remove unused import. [#1479], credits to [@jiwom]. ### [v8.3.0] - 2017-10-26 **ADDED** - `DataTables` factory class is now Macroable. [#1462] - `query()` api added as a replacement for `queryBuilder()`. [#1462] **CHANGED** - Support for plugin engine methods. [#1462], credits to [@pimlie]. - `datatables.builders` config is now optional/redundant. [#1462] - Deprecate `queryBuilder()` api and replaced with `query()`. **FIXED** - Support for custom engines (eg for mongodb) [#1294], ### [v8.2.0] - 2017-10-25 **FIXED** - Fix changelog links. [#1449] - Rename phpunit.xml and add composer script. [#1460], credits to [@pimlie]. - Fix exception/warning for PHP 7.2. [#1465], credits to [@CristianDeluxe](https://github.com/CristianDeluxe). - Fix facade method annotations. [#1468], credits to [@Guja1501](https://github.com/Guja1501). - Fix globalSearch not working for 0. [#1467], credits to [@lrtr](https://github.com/lrtr). **ADDED/CHANGED** - Make wildcard string a function parameter. [#1461], credits to [@pimlie]. ### [v8.1.1] - 2017-10-17 - Fix docs API link. [#1438], credits to [@dextermb](https://github.com/dextermb). - Fix merging config. [#1444], credits to [@ElfSundae]. - Fix return type. [#1446], credits to [@gabriel-caruso]. - Remove unused provides() from service provider. [#1445], credits to [@ElfSundae]. ### [v8.1.0] - 2017-10-08 - Add addColumns() to EloquentDataTable. [#1416], credits to [@ElfSundae]. ### [v8.0.3] - 2017-09-12 - Fix compatibility with Lumen. [#1382] - Fix [#1377]. ### [v8.0.2] - 2017-09-06 - Remove void return type. - Fix [#1367], [#1368]. ### [v8.0.1] - 2017-08-31 - Do not resolve column if relation is not eager loaded. [#1355] - Fix [#1353], sort/search not working when using join statements. - Add tests for join statements. ### [v8.0.0] - 2017-08-31 ### ADDED - Add support for Laravel 5.5. - Package auto-discovery implemented. - Add the raw data to model key when compiling views when using addColumn and editColumn. - Make multi-term search configurable. - Source code clean-up, refactoring and type-hinting. - Improved scrutinizer code quality score from 6 to ~9 pts. - On the fly support for `SoftDeletes`. No need to use `withTrashed` and `onlyTrashed`. - Add `getQuery` api to get the query used by dataTable. - Add `getFilteredQuery` api to get the prepared (filtered, ordered & paginated) query. - Add `Arrayable` and `Jsonable` interface for a more Laravel like response. ```php use Yajra\DataTables\Facades\DataTables; return DataTables::eloquent(User::query())->toJson(); return DataTables::eloquent(User::query())->toArray(); ``` - Introducing a new OOP / intuitive syntax. ```php // using DataTables Factory use Yajra\DataTables\DataTables; return DataTables::of(User::query())->toJson(); return (new DataTables)->eloquent(User::query())->toJson(); return (new DataTables)->queryBuilder(DB::table('users'))->toJson(); return (new DataTables)->collection(User::all())->toJson(); // using DataTable class directly use Yajra\DataTables\EloquentDataTable; return (new EloquentDataTable(User::query())->toJson(); use Yajra\DataTables\QueryDataTable; return (new QueryDataTable(DB::table('users'))->toJson(); use Yajra\DataTables\CollectionDataTable; return (new CollectionDataTable(User::all())->toJson(); ``` - Add `datatables()` function helper. ### CHANGED - Namespace changed from `Yajra\Datatables` to `Yajra\DataTables`. - Rename `Datatables` to `DataTables` class. - Rename Facade from `Datatables` to `DataTables` class. - Preserve `Eloquent\Builder` when overriding the default ordering of dataTables when using `EloquentEngine`. - Preserve `Eloquent\Builder` when using filterColumn api. Allows us to use model scope and any eloquent magics. - Fractal integration extracted to own plugin [laravel-datatables-fractal]. - Raw output are always passed on transformer instance. - Object response is now the default output `public function make($mDataSupport = true)`. ### REMOVED - Remove `filterColumn` api magic query method in favor of closure. - Remove support on older `snake_case` methods. - Remove silly implementation of proxying query builder calls via magic method. - Removed unused methods. - Remove `withTrashed` and `onlyTrashed` api. ### FIXED - How to get full used query ? [#1068] - Is there a way to build the query (with filtering and sorting) but without execute it? [#1234] - Fix orderColumn api where related tables are not joined. - Fix nested with relation search and sort function. [Unreleased]: https://github.com/yajra/laravel-datatables/compare/v9.21.2...9.0 [v9.21.2]: https://github.com/yajra/laravel-datatables/compare/v9.21.1...v9.21.2 [v9.21.0]: https://github.com/yajra/laravel-datatables/compare/v9.20.0...v9.21.0 [v9.20.0]: https://github.com/yajra/laravel-datatables/compare/v9.19.1...v9.20.0 [v9.19.1]: https://github.com/yajra/laravel-datatables/compare/v9.19.1...v9.19.1 [v9.19.0]: https://github.com/yajra/laravel-datatables/compare/v9.18.2...v9.19.0 [v9.18.2]: https://github.com/yajra/laravel-datatables/compare/v9.18.1...v9.18.2 [v9.18.1]: https://github.com/yajra/laravel-datatables/compare/v9.18.0...v9.18.1 [v9.18.0]: https://github.com/yajra/laravel-datatables/compare/v9.17.4...v9.18.0 [v9.17.4]: https://github.com/yajra/laravel-datatables/compare/v9.17.3...v9.17.4 [v9.17.3]: https://github.com/yajra/laravel-datatables/compare/v9.17.2...v9.17.3 [v9.17.2]: https://github.com/yajra/laravel-datatables/compare/v9.17.1...v9.17.2 [v9.17.1]: https://github.com/yajra/laravel-datatables/compare/v9.17.0...v9.17.1 [v9.17.0]: https://github.com/yajra/laravel-datatables/compare/v9.16.0...v9.17.0 [v9.16.0]: https://github.com/yajra/laravel-datatables/compare/v9.15.2...v9.16.0 [v9.15.2]: https://github.com/yajra/laravel-datatables/compare/v9.15.1...v9.15.2 [v9.15.1]: https://github.com/yajra/laravel-datatables/compare/v9.15.0...v9.15.1 [v9.15.0]: https://github.com/yajra/laravel-datatables/compare/v9.14.2...v9.15.0 [v9.14.2]: https://github.com/yajra/laravel-datatables/compare/v9.14.1...v9.14.2 [v9.14.1]: https://github.com/yajra/laravel-datatables/compare/v9.14.0...v9.14.1 [v9.14.0]: https://github.com/yajra/laravel-datatables/compare/v9.13.0...v9.14.0 [v9.13.0]: https://github.com/yajra/laravel-datatables/compare/v9.12.0...v9.13.0 [v9.12.0]: https://github.com/yajra/laravel-datatables/compare/v9.11.1...v9.12.0 [v9.11.1]: https://github.com/yajra/laravel-datatables/compare/v9.11.0...v9.11.1 [v9.11.0]: https://github.com/yajra/laravel-datatables/compare/v9.10.2...v9.11.0 [v9.10.2]: https://github.com/yajra/laravel-datatables/compare/v9.10.1...v9.10.2 [v9.10.1]: https://github.com/yajra/laravel-datatables/compare/v9.10.0...v9.10.1 [v9.10.0]: https://github.com/yajra/laravel-datatables/compare/v9.9.0...v9.10.0 [v9.9.0]: https://github.com/yajra/laravel-datatables/compare/v9.8.0...v9.9.0 [v9.8.0]: https://github.com/yajra/laravel-datatables/compare/v9.7.2...v9.8.0 [v9.7.2]: https://github.com/yajra/laravel-datatables/compare/v9.7.1...v9.7.2 [v9.7.1]: https://github.com/yajra/laravel-datatables/compare/v9.7.0...v9.7.1 [v9.7.0]: https://github.com/yajra/laravel-datatables/compare/v9.6.1...v9.7.0 [v9.6.1]: https://github.com/yajra/laravel-datatables/compare/v9.6.0...v9.6.1 [v9.6.0]: https://github.com/yajra/laravel-datatables/compare/v9.5.0...v9.6.0 [v9.5.0]: https://github.com/yajra/laravel-datatables/compare/v9.4.1...v9.5.0 [v9.4.1]: https://github.com/yajra/laravel-datatables/compare/v9.4.0...v9.4.1 [v9.4.0]: https://github.com/yajra/laravel-datatables/compare/v9.3.0...v9.4.0 [v9.3.0]: https://github.com/yajra/laravel-datatables/compare/v9.2.0...v9.3.0 [v9.2.0]: https://github.com/yajra/laravel-datatables/compare/v9.1.1...v9.2.0 [v9.1.1]: https://github.com/yajra/laravel-datatables/compare/v9.1.0...v9.1.1 [v9.1.0]: https://github.com/yajra/laravel-datatables/compare/v9.0.1...v9.1.0 [v9.0.1]: https://github.com/yajra/laravel-datatables/compare/v9.0.0...v9.0.1 [v9.0.0]: https://github.com/yajra/laravel-datatables/compare/v8.13.5...v9.0.0 [v8.13.5]: https://github.com/yajra/laravel-datatables/compare/v8.13.4...v8.13.5 [v8.13.4]: https://github.com/yajra/laravel-datatables/compare/v8.13.3...v8.13.4 [v8.13.3]: https://github.com/yajra/laravel-datatables/compare/v8.13.2...v8.13.3 [v8.13.2]: https://github.com/yajra/laravel-datatables/compare/v8.13.1...v8.13.2 [v8.13.1]: https://github.com/yajra/laravel-datatables/compare/v8.13.0...v8.13.1 [v8.13.0]: https://github.com/yajra/laravel-datatables/compare/v8.11.0...v8.13.0 [v8.11.0]: https://github.com/yajra/laravel-datatables/compare/v8.10.0...v8.11.0 [v8.10.0]: https://github.com/yajra/laravel-datatables/compare/v8.9.2...v8.10.0 [v8.9.2]: https://github.com/yajra/laravel-datatables/compare/v8.9.1...v8.9.2 [v8.9.1]: https://github.com/yajra/laravel-datatables/compare/v8.9.0...v8.9.1 [v8.9.0]: https://github.com/yajra/laravel-datatables/compare/v8.8.0...v8.9.0 [v8.8.0]: https://github.com/yajra/laravel-datatables/compare/v8.7.1...v8.8.0 [v8.7.1]: https://github.com/yajra/laravel-datatables/compare/v8.7.0...v8.7.1 [v8.7.0]: https://github.com/yajra/laravel-datatables/compare/v8.6.1...v8.7.0 [v8.6.1]: https://github.com/yajra/laravel-datatables/compare/v8.6.0...v8.6.1 [v8.6.0]: https://github.com/yajra/laravel-datatables/compare/v8.5.2...v8.6.0 [v8.5.2]: https://github.com/yajra/laravel-datatables/compare/v8.5.1...v8.5.2 [v8.5.1]: https://github.com/yajra/laravel-datatables/compare/v8.5.0...v8.5.1 [v8.5.0]: https://github.com/yajra/laravel-datatables/compare/v8.4.4...v8.5.0 [v8.4.4]: https://github.com/yajra/laravel-datatables/compare/v8.4.3...v8.4.4 [v8.4.3]: https://github.com/yajra/laravel-datatables/compare/v8.4.2...v8.4.3 [v8.4.2]: https://github.com/yajra/laravel-datatables/compare/v8.4.1...v8.4.2 [v8.4.1]: https://github.com/yajra/laravel-datatables/compare/v8.4.0...v8.4.1 [v8.4.0]: https://github.com/yajra/laravel-datatables/compare/v8.3.3...v8.4.0 [v8.3.3]: https://github.com/yajra/laravel-datatables/compare/v8.3.2...v8.3.3 [v8.3.2]: https://github.com/yajra/laravel-datatables/compare/v8.3.1...v8.3.2 [v8.3.1]: https://github.com/yajra/laravel-datatables/compare/v8.3.0...v8.3.1 [v8.3.0]: https://github.com/yajra/laravel-datatables/compare/v8.2.0...v8.3.0 [v8.2.0]: https://github.com/yajra/laravel-datatables/compare/v8.1.1...v8.2.0 [v8.1.1]: https://github.com/yajra/laravel-datatables/compare/v8.1.0...v8.1.1 [v8.1.0]: https://github.com/yajra/laravel-datatables/compare/v8.0.3...v8.1.0 [v8.0.3]: https://github.com/yajra/laravel-datatables/compare/v8.0.2...v8.0.3 [v8.0.2]: https://github.com/yajra/laravel-datatables/compare/v8.0.1...v8.0.2 [v8.0.1]: https://github.com/yajra/laravel-datatables/compare/v8.0.0...v8.0.1 [v8.0.0]: https://github.com/yajra/laravel-datatables/compare/v7.10.1...v8.0.0 [#1702]: https://github.com/yajra/laravel-datatables/pull/1702 [#1728]: https://github.com/yajra/laravel-datatables/pull/1728 [#1724]: https://github.com/yajra/laravel-datatables/pull/1724 [#1719]: https://github.com/yajra/laravel-datatables/pull/1719 [#1688]: https://github.com/yajra/laravel-datatables/pull/1688 [#1658]: https://github.com/yajra/laravel-datatables/pull/1658 [#1628]: https://github.com/yajra/laravel-datatables/pull/1628 [#1624]: https://github.com/yajra/laravel-datatables/pull/1624 [#1609]: https://github.com/yajra/laravel-datatables/pull/1609 [#1492]: https://github.com/yajra/laravel-datatables/pull/1492 [#1489]: https://github.com/yajra/laravel-datatables/pull/1489 [#1487]: https://github.com/yajra/laravel-datatables/pull/1487 [#1485]: https://github.com/yajra/laravel-datatables/pull/1485 [#1484]: https://github.com/yajra/laravel-datatables/pull/1484 [#1483]: https://github.com/yajra/laravel-datatables/pull/1483 [#1473]: https://github.com/yajra/laravel-datatables/pull/1473 [#1476]: https://github.com/yajra/laravel-datatables/pull/1476 [#1478]: https://github.com/yajra/laravel-datatables/pull/1478 [#1479]: https://github.com/yajra/laravel-datatables/pull/1479 [#1462]: https://github.com/yajra/laravel-datatables/pull/1462 [#1468]: https://github.com/yajra/laravel-datatables/pull/1468 [#1467]: https://github.com/yajra/laravel-datatables/pull/1467 [#1465]: https://github.com/yajra/laravel-datatables/pull/1465 [#1461]: https://github.com/yajra/laravel-datatables/pull/1461 [#1460]: https://github.com/yajra/laravel-datatables/pull/1460 [#1449]: https://github.com/yajra/laravel-datatables/pull/1449 [#1438]: https://github.com/yajra/laravel-datatables/pull/1438 [#1444]: https://github.com/yajra/laravel-datatables/pull/1444 [#1446]: https://github.com/yajra/laravel-datatables/pull/1446 [#1445]: https://github.com/yajra/laravel-datatables/pull/1445 [#1416]: https://github.com/yajra/laravel-datatables/pull/1416 [#1382]: https://github.com/yajra/laravel-datatables/pull/1382 [#1368]: https://github.com/yajra/laravel-datatables/pull/1368 [#1355]: https://github.com/yajra/laravel-datatables/pull/1355 [#1569]: https://github.com/yajra/laravel-datatables/pull/1569 [#1554]: https://github.com/yajra/laravel-datatables/pull/1554 [#1553]: https://github.com/yajra/laravel-datatables/pull/1553 [#1536]: https://github.com/yajra/laravel-datatables/pull/1536 [#1532]: https://github.com/yajra/laravel-datatables/pull/1532 [#1496]: https://github.com/yajra/laravel-datatables/pull/1496 [#1730]: https://github.com/yajra/laravel-datatables/pull/1730 [#1737]: https://github.com/yajra/laravel-datatables/pull/1737 [#1741]: https://github.com/yajra/laravel-datatables/pull/1741 [#1743]: https://github.com/yajra/laravel-datatables/pull/1743 [#1758]: https://github.com/yajra/laravel-datatables/pull/1758 [#1759]: https://github.com/yajra/laravel-datatables/pull/1759 [#1792]: https://github.com/yajra/laravel-datatables/pull/1792 [#1830]: https://github.com/yajra/laravel-datatables/pull/1830 [#1860]: https://github.com/yajra/laravel-datatables/pull/1860 [#1811]: https://github.com/yajra/laravel-datatables/pull/1811 [#1882]: https://github.com/yajra/laravel-datatables/pull/1882 [#1911]: https://github.com/yajra/laravel-datatables/pull/1911 [#1912]: https://github.com/yajra/laravel-datatables/pull/1912 [#1852]: https://github.com/yajra/laravel-datatables/pull/1852 [#1942]: https://github.com/yajra/laravel-datatables/pull/1942 [#1960]: https://github.com/yajra/laravel-datatables/pull/1960 [#1988]: https://github.com/yajra/laravel-datatables/pull/1988 [#2001]: https://github.com/yajra/laravel-datatables/pull/2001 [#2002]: https://github.com/yajra/laravel-datatables/pull/2002 [#1813]: https://github.com/yajra/laravel-datatables/pull/1813 [#2067]: https://github.com/yajra/laravel-datatables/pull/2067 [#2051]: https://github.com/yajra/laravel-datatables/pull/2051 [#2072]: https://github.com/yajra/laravel-datatables/pull/2072 [#2082]: https://github.com/yajra/laravel-datatables/pull/2082 [#2079]: https://github.com/yajra/laravel-datatables/pull/2079 [#2083]: https://github.com/yajra/laravel-datatables/pull/2083 [#2088]: https://github.com/yajra/laravel-datatables/pull/2088 [#2085]: https://github.com/yajra/laravel-datatables/pull/2085 [#2102]: https://github.com/yajra/laravel-datatables/pull/2102 [#2084]: https://github.com/yajra/laravel-datatables/pull/2084 [#2103]: https://github.com/yajra/laravel-datatables/pull/2103 [#2163]: https://github.com/yajra/laravel-datatables/pull/2163 [#2171]: https://github.com/yajra/laravel-datatables/pull/2171 [#2191]: https://github.com/yajra/laravel-datatables/pull/2191 [#2199]: https://github.com/yajra/laravel-datatables/pull/2199 [#2222]: https://github.com/yajra/laravel-datatables/pull/2222 [#2240]: https://github.com/yajra/laravel-datatables/pull/2240 [#2263]: https://github.com/yajra/laravel-datatables/pull/2263 [#2332]: https://github.com/yajra/laravel-datatables/pull/2332 [#2368]: https://github.com/yajra/laravel-datatables/pull/2368 [#2399]: https://github.com/yajra/laravel-datatables/pull/2399 [#2391]: https://github.com/yajra/laravel-datatables/pull/2391 [#2382]: https://github.com/yajra/laravel-datatables/pull/2382 [#2414]: https://github.com/yajra/laravel-datatables/pull/2414 [#2478]: https://github.com/yajra/laravel-datatables/pull/2478 [#2481]: https://github.com/yajra/laravel-datatables/pull/2481 [#2475]: https://github.com/yajra/laravel-datatables/pull/2475 [#2193]: https://github.com/yajra/laravel-datatables/pull/2193 [#2513]: https://github.com/yajra/laravel-datatables/pull/2513 [#2535]: https://github.com/yajra/laravel-datatables/pull/2535 [#2536]: https://github.com/yajra/laravel-datatables/pull/2536 [#2540]: https://github.com/yajra/laravel-datatables/pull/2540 [#2585]: https://github.com/yajra/laravel-datatables/pull/2585 [#2580]: https://github.com/yajra/laravel-datatables/pull/2580 [#1934]: https://github.com/yajra/laravel-datatables/issues/1934 [#2091]: https://github.com/yajra/laravel-datatables/issues/2091 [#2058]: https://github.com/yajra/laravel-datatables/issues/2058 [#1626]: https://github.com/yajra/laravel-datatables/issues/1626 [#1617]: https://github.com/yajra/laravel-datatables/issues/1617 [#1294]: https://github.com/yajra/laravel-datatables/issues/1294 [#1068]: https://github.com/yajra/laravel-datatables/issues/1068 [#1234]: https://github.com/yajra/laravel-datatables/issues/1234 [#1353]: https://github.com/yajra/laravel-datatables/issues/1353 [#1367]: https://github.com/yajra/laravel-datatables/issues/1367 [#1377]: https://github.com/yajra/laravel-datatables/issues/1377 [#1515]: https://github.com/yajra/laravel-datatables/issues/1515 [#1659]: https://github.com/yajra/laravel-datatables/issues/1659 [#1351]: https://github.com/yajra/laravel-datatables/issues/1351 [#1600]: https://github.com/yajra/laravel-datatables/issues/1600 [#1471]: https://github.com/yajra/laravel-datatables/issues/1471 [#1739]: https://github.com/yajra/laravel-datatables/issues/1739 [#1516]: https://github.com/yajra/laravel-datatables/issues/1516 [#1752]: https://github.com/yajra/laravel-datatables/issues/1752 [#1824]: https://github.com/yajra/laravel-datatables/issues/1824 [#1805]: https://github.com/yajra/laravel-datatables/issues/1805 [#1747]: https://github.com/yajra/laravel-datatables/issues/1747 [#1951]: https://github.com/yajra/laravel-datatables/issues/1951 [#1983]: https://github.com/yajra/laravel-datatables/issues/1983 [#2003]: https://github.com/yajra/laravel-datatables/issues/2003 [#2045]: https://github.com/yajra/laravel-datatables/issues/2045 [#2054]: https://github.com/yajra/laravel-datatables/issues/2054 [#2024]: https://github.com/yajra/laravel-datatables/issues/2024 [#1977]: https://github.com/yajra/laravel-datatables/issues/1977 [#880]: https://github.com/yajra/laravel-datatables/issues/880 [#577]: https://github.com/yajra/laravel-datatables/issues/577 [#522]: https://github.com/yajra/laravel-datatables/issues/522 [#2161]: https://github.com/yajra/laravel-datatables/issues/2161 [#2156]: https://github.com/yajra/laravel-datatables/issues/2156 [#1822]: https://github.com/yajra/laravel-datatables/issues/1822 [#1738]: https://github.com/yajra/laravel-datatables/issues/1738 [#2202]: https://github.com/yajra/laravel-datatables/issues/2202 [#1975]: https://github.com/yajra/laravel-datatables/issues/1975 [#1747]: https://github.com/yajra/laravel-datatables/issues/1747 [#1953]: https://github.com/yajra/laravel-datatables/issues/1953 [#2463]: https://github.com/yajra/laravel-datatables/issues/2463 [#2471]: https://github.com/yajra/laravel-datatables/issues/2471 [#2534]: https://github.com/yajra/laravel-datatables/issues/2534 [laravel-datatables-fractal]: https://github.com/yajra/laravel-datatables-fractal [@sskl]: https://github.com/sskl [@drbyte]: https://github.com/drbyte [@drahosistvan]: https://github.com/drahosistvan [@LEI]: https://github.com/LEI [@marcoocram]: https://github.com/marcoocram [@ElfSundae]: https://github.com/ElfSundae [@carusogabriel]: https://github.com/carusogabriel [@gabriel-caruso]: https://github.com/gabriel-caruso [@pimlie]: https://github.com/pimlie [@jiwom]: https://github.com/jiwom [@Oussama-Tn]: https://github.com/Oussama-Tn [@redelschaap]: https://github.com/redelschaap [@nunomaduro]: https://github.com/nunomaduro [@asahasrabuddhe]: https://github.com/asahasrabuddhe [@fschalkwijk]: https://github.com/fschalkwijk [@forgottencreature]: https://github.com/forgottencreature [@ptuchik]: https://github.com/ptuchik [@zeyad82]: https://github.com/zeyad82 [@sharifzadesina]: https://github.com/sharifzadesina [@ridaamirini]: https://github.com/ridaamirini [@Spodnet]: https://github.com/Spodnet [@royduin]: https://github.com/royduin [@sgotre]: https://github.com/sgotre [@lukchojnicki]: https://github.com/lukchojnicki [@Morinohtar]: https://github.com/Morinohtar [@Arkhas]: https://github.com/Arkhas [@apreiml]: https://github.com/apreiml [@Stokoe0990]: https://github.com/Stokoe0990 [@drsdre]: https://github.com/drsdre [@selecod]: https://github.com/selecod [@lloricode]: https://github.com/lloricode [@mtvbrianking]: https://github.com/mtvbrianking [@imTigger]: https://github.com/imTigger [@barryvdh]: https://github.com/barryvdh [@warlof]: https://github.com/warlof [@ehsanrasta]: https://github.com/ehsanrasta [@mgralikowski]: https://github.com/mgralikowski [@edwwaarrdd]: https://github.com/edwwaarrdd [@miken32]: https://github.com/miken32 [@gredimano]: https://github.com/gredimano laravel-datatables-oracle/LICENSE.md 0000644 00000002117 15021222520 0013133 0 ustar 00 (The MIT License) Copyright (c) 2013-2021 Arjay Angeles <aqangeles@gmail.com> 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. laravel-datatables-oracle/src/Utilities/Config.php 0000644 00000004311 15021222520 0016205 0 ustar 00 <?php namespace Yajra\DataTables\Utilities; use Illuminate\Contracts\Config\Repository; class Config { /** * @var \Illuminate\Contracts\Config\Repository */ private $repository; /** * Config constructor. * * @param \Illuminate\Contracts\Config\Repository $repository */ public function __construct(Repository $repository) { $this->repository = $repository; } /** * Check if config uses wild card search. * * @return bool */ public function isWildcard() { return $this->repository->get('datatables.search.use_wildcards', false); } /** * Check if config uses smart search. * * @return bool */ public function isSmartSearch() { return $this->repository->get('datatables.search.smart', true); } /** * Check if config uses case insensitive search. * * @return bool */ public function isCaseInsensitive() { return $this->repository->get('datatables.search.case_insensitive', false); } /** * Check if app is in debug mode. * * @return bool */ public function isDebugging() { return $this->repository->get('app.debug', false); } /** * Get the specified configuration value. * * @param string $key * @param mixed $default * @return mixed */ public function get($key, $default = null) { return $this->repository->get($key, $default); } /** * Set a given configuration value. * * @param array|string $key * @param mixed $value * @return void */ public function set($key, $value = null) { $this->repository->set($key, $value); } /** * Check if dataTable config uses multi-term searching. * * @return bool */ public function isMultiTerm() { return $this->repository->get('datatables.search.multi_term', true); } /** * Check if dataTable config uses starts_with searching. * * @return bool */ public function isStartsWithSearch() { return $this->repository->get('datatables.search.starts_with', false); } } laravel-datatables-oracle/src/Utilities/Request.php 0000644 00000013364 15021222520 0016440 0 ustar 00 <?php namespace Yajra\DataTables\Utilities; /** * @mixin \Illuminate\Http\Request */ class Request { /** * @var \Illuminate\Http\Request */ protected $request; /** * Request constructor. */ public function __construct() { $this->request = app('request'); } /** * Proxy non existing method calls to request class. * * @param mixed $name * @param mixed $arguments * @return mixed */ public function __call($name, $arguments) { if (method_exists($this->request, $name)) { return call_user_func_array([$this->request, $name], $arguments); } } /** * Get attributes from request instance. * * @param string $name * @return mixed */ public function __get($name) { return $this->request->__get($name); } /** * Get all columns request input. * * @return array */ public function columns() { return (array) $this->request->input('columns'); } /** * Check if DataTables is searchable. * * @return bool */ public function isSearchable() { return $this->request->input('search.value') != ''; } /** * Check if DataTables must uses regular expressions. * * @param int $index * @return bool */ public function isRegex($index) { return $this->request->input("columns.$index.search.regex") === 'true'; } /** * Get orderable columns. * * @return array */ public function orderableColumns() { if (! $this->isOrderable()) { return []; } $orderable = []; for ($i = 0, $c = count($this->request->input('order')); $i < $c; $i++) { $order_col = (int) $this->request->input("order.$i.column"); $order_dir = strtolower($this->request->input("order.$i.dir")) === 'asc' ? 'asc' : 'desc'; if ($this->isColumnOrderable($order_col)) { $orderable[] = ['column' => $order_col, 'direction' => $order_dir]; } } return $orderable; } /** * Check if DataTables ordering is enabled. * * @return bool */ public function isOrderable() { return $this->request->input('order') && count($this->request->input('order')) > 0; } /** * Check if a column is orderable. * * @param int $index * @return bool */ public function isColumnOrderable($index) { return $this->request->input("columns.$index.orderable", 'true') == 'true'; } /** * Get searchable column indexes. * * @return array */ public function searchableColumnIndex() { $searchable = []; for ($i = 0, $c = count($this->request->input('columns')); $i < $c; $i++) { if ($this->isColumnSearchable($i, false)) { $searchable[] = $i; } } return $searchable; } /** * Check if a column is searchable. * * @param int $i * @param bool $column_search * @return bool */ public function isColumnSearchable($i, $column_search = true) { if ($column_search) { return ( $this->request->input("columns.$i.searchable", 'true') === 'true' || $this->request->input("columns.$i.searchable", 'true') === true ) && $this->columnKeyword($i) != ''; } return $this->request->input("columns.$i.searchable", 'true') === 'true' || $this->request->input("columns.$i.searchable", 'true') === true; } /** * Get column's search value. * * @param int $index * @return string */ public function columnKeyword($index) { $keyword = $this->request->input("columns.$index.search.value") ?? ''; return $this->prepareKeyword($keyword); } /** * Prepare keyword string value. * * @param string|array $keyword * @return string */ protected function prepareKeyword($keyword) { if (is_array($keyword)) { return implode(' ', $keyword); } return $keyword; } /** * Get global search keyword. * * @return string */ public function keyword() { $keyword = $this->request->input('search.value') ?? ''; return $this->prepareKeyword($keyword); } /** * Get column identity from input or database. * * @param int $i * @param string|null $type * @return string */ public function columnName($i, $type = null) { $column = $this->request->input("columns.$i"); if (isset($type) && isset($column['data']) && is_array($column['data'])) { if (isset($column['data'][$type]) && $column['data'][$type] != '') { return $column['data'][$type]; } if (isset($column['data']['display']) && $column['data']['display'] != '') { return $column['data']['display']; } if (isset($column['data']['_']) && $column['data']['_'] != '') { return $column['data']['_']; } return $column['name']; } return isset($column['name']) && $column['name'] != '' ? $column['name'] : $column['data']; } /** * Check if DataTables allow pagination. * * @return bool */ public function isPaginationable() { return ! is_null($this->request->input('start')) && ! is_null($this->request->input('length')) && $this->request->input('length') != -1; } } laravel-datatables-oracle/src/Utilities/Helper.php 0000644 00000017746 15021222520 0016237 0 ustar 00 <?php namespace Yajra\DataTables\Utilities; use DateTime; use Illuminate\Contracts\Support\Arrayable; use Illuminate\Support\Arr; use Illuminate\Support\Str; class Helper { /** * Places item of extra columns into results by care of their order. * * @param array $item * @param array $array * @return array */ public static function includeInArray($item, $array) { if (self::isItemOrderInvalid($item, $array)) { return array_merge($array, [$item['name'] => $item['content']]); } $count = 0; $last = $array; $first = []; foreach ($array as $key => $value) { if ($count == $item['order']) { return array_merge($first, [$item['name'] => $item['content']], $last); } unset($last[$key]); $first[$key] = $value; $count++; } } /** * Check if item order is valid. * * @param array $item * @param array $array * @return bool */ protected static function isItemOrderInvalid($item, $array) { return $item['order'] === false || $item['order'] >= count($array); } /** * Determines if content is callable or blade string, processes and returns. * * @param mixed $content Pre-processed content * @param array $data data to use with blade template * @param mixed $param parameter to call with callable * @return mixed */ public static function compileContent($content, array $data, $param) { if (is_string($content)) { return static::compileBlade($content, static::getMixedValue($data, $param)); } if (is_callable($content)) { $reflection = new \ReflectionFunction($content); $arguments = $reflection->getParameters(); if (count($arguments) > 0) { return app()->call($content, [$arguments[0]->name => $param]); } return $content($param); } return $content; } /** * Parses and compiles strings by using Blade Template System. * * @param string $str * @param array $data * @return mixed * * @throws \Exception */ public static function compileBlade($str, $data = []) { if (view()->exists($str)) { return view($str, $data)->render(); } ob_start() && extract($data, EXTR_SKIP); eval('?>' . app('blade.compiler')->compileString($str)); $str = ob_get_contents(); ob_end_clean(); return $str; } /** * Get a mixed value of custom data and the parameters. * * @param array $data * @param mixed $param * @return array */ public static function getMixedValue(array $data, $param) { $casted = self::castToArray($param); $data['model'] = $param; foreach ($data as $key => $value) { if (isset($casted[$key])) { $data[$key] = $casted[$key]; } } return $data; } /** * Cast the parameter into an array. * * @param mixed $param * @return array */ public static function castToArray($param) { if ($param instanceof \stdClass) { $param = (array) $param; return $param; } if ($param instanceof Arrayable) { return $param->toArray(); } return $param; } /** * Get equivalent or method of query builder. * * @param string $method * @return string */ public static function getOrMethod($method) { if (! Str::contains(Str::lower($method), 'or')) { return 'or' . ucfirst($method); } return $method; } /** * Converts array object values to associative array. * * @param mixed $row * @param array $filters * @return array */ public static function convertToArray($row, $filters = []) { $row = is_object($row) && method_exists($row, 'makeHidden') ? $row->makeHidden(Arr::get($filters, 'hidden', [])) : $row; $row = is_object($row) && method_exists($row, 'makeVisible') ? $row->makeVisible(Arr::get($filters, 'visible', [])) : $row; $data = $row instanceof Arrayable ? $row->toArray() : (array) $row; foreach ($data as &$value) { if (is_object($value) || is_array($value)) { $value = self::convertToArray($value); } unset($value); } return $data; } /** * @param array $data * @return array */ public static function transform(array $data) { return array_map(function ($row) { return self::transformRow($row); }, $data); } /** * Transform row data into an array. * * @param mixed $row * @return array */ protected static function transformRow($row) { foreach ($row as $key => $value) { if ($value instanceof DateTime) { $row[$key] = $value->format('Y-m-d H:i:s'); } else { if (is_object($value)) { $row[$key] = (string) $value; } else { $row[$key] = $value; } } } return $row; } /** * Build parameters depending on # of arguments passed. * * @param array $args * @return array */ public static function buildParameters(array $args) { $parameters = []; if (count($args) > 2) { $parameters[] = $args[0]; foreach ($args[1] as $param) { $parameters[] = $param; } } else { foreach ($args[0] as $param) { $parameters[] = $param; } } return $parameters; } /** * Replace all pattern occurrences with keyword. * * @param array $subject * @param string $keyword * @param string $pattern * @return array */ public static function replacePatternWithKeyword(array $subject, $keyword, $pattern = '$1') { $parameters = []; foreach ($subject as $param) { if (is_array($param)) { $parameters[] = self::replacePatternWithKeyword($param, $keyword, $pattern); } else { $parameters[] = str_replace($pattern, $keyword, $param); } } return $parameters; } /** * Get column name from string. * * @param string $str * @param bool $wantsAlias * @return string */ public static function extractColumnName($str, $wantsAlias) { $matches = explode(' as ', Str::lower($str)); if (! empty($matches)) { if ($wantsAlias) { return array_pop($matches); } return array_shift($matches); } elseif (strpos($str, '.')) { $array = explode('.', $str); return array_pop($array); } return $str; } /** * Adds % wildcards to the given string. * * @param string $str * @param bool $lowercase * @return string */ public static function wildcardLikeString($str, $lowercase = true) { return static::wildcardString($str, '%', $lowercase); } /** * Adds wildcards to the given string. * * @param string $str * @param string $wildcard * @param bool $lowercase * @return string */ public static function wildcardString($str, $wildcard, $lowercase = true) { $wild = $wildcard; $chars = preg_split('//u', $str, -1, PREG_SPLIT_NO_EMPTY); if (count($chars) > 0) { foreach ($chars as $char) { $wild .= $char . $wildcard; } } if ($lowercase) { $wild = Str::lower($wild); } return $wild; } } laravel-datatables-oracle/src/Facades/DataTables.php 0000644 00000001147 15021222520 0016363 0 ustar 00 <?php namespace Yajra\DataTables\Facades; use Illuminate\Support\Facades\Facade; /** * @mixin \Yajra\DataTables\DataTables * * @method static \Yajra\DataTables\EloquentDatatable eloquent($builder) * @method static \Yajra\DataTables\QueryDataTable query($builder) * @method static \Yajra\DataTables\CollectionDataTable collection($collection) * * @see \Yajra\DataTables\DataTables */ class DataTables extends Facade { /** * Get the registered name of the component. * * @return string */ protected static function getFacadeAccessor() { return 'datatables'; } } laravel-datatables-oracle/src/helper.php 0000644 00000000732 15021222520 0014307 0 ustar 00 <?php if (! function_exists('datatables')) { /** * Helper to make a new DataTable instance from source. * Or return the factory if source is not set. * * @param mixed $source * @return \Yajra\DataTables\DataTableAbstract|\Yajra\DataTables\DataTables */ function datatables($source = null) { if (is_null($source)) { return app('datatables'); } return app('datatables')->make($source); } } laravel-datatables-oracle/src/lumen.php 0000644 00000001050 15021222520 0014142 0 ustar 00 <?php if (! function_exists('config_path')) { /** * Get the configuration path. * * @param string $path * @return string */ function config_path($path = '') { return app()->basePath() . '/config' . ($path ? '/' . $path : $path); } } if (! function_exists('public_path')) { /** * Return the path to public dir. * * @param null $path * @return string */ function public_path($path = null) { return rtrim(app()->basePath('public/' . $path), '/'); } } laravel-datatables-oracle/src/Exceptions/Exception.php 0000644 00000000126 15021222520 0017104 0 ustar 00 <?php namespace Yajra\DataTables\Exceptions; class Exception extends \Exception { } laravel-datatables-oracle/src/Processors/RowProcessor.php 0000644 00000003123 15021222520 0017636 0 ustar 00 <?php namespace Yajra\DataTables\Processors; use Illuminate\Support\Arr; use Yajra\DataTables\Utilities\Helper; class RowProcessor { /** * @var mixed */ private $data; /** * @var mixed */ private $row; /** * @param mixed $data * @param mixed $row */ public function __construct($data, $row) { $this->data = $data; $this->row = $row; } /** * Process DT RowId and Class value. * * @param string $attribute * @param string|callable $template * @return $this */ public function rowValue($attribute, $template) { if (! empty($template)) { if (! is_callable($template) && Arr::get($this->data, $template)) { $this->data[$attribute] = Arr::get($this->data, $template); } else { $this->data[$attribute] = Helper::compileContent($template, $this->data, $this->row); } } return $this; } /** * Process DT Row Data and Attr. * * @param string $attribute * @param array $template * @return $this */ public function rowData($attribute, array $template) { if (count($template)) { $this->data[$attribute] = []; foreach ($template as $key => $value) { $this->data[$attribute][$key] = Helper::compileContent($value, $this->data, $this->row); } } return $this; } /** * @return mixed */ public function getData() { return $this->data; } } laravel-datatables-oracle/src/Processors/DataProcessor.php 0000644 00000015760 15021222520 0017752 0 ustar 00 <?php namespace Yajra\DataTables\Processors; use Illuminate\Contracts\Support\Htmlable; use Illuminate\Support\Arr; use Yajra\DataTables\Contracts\Formatter; use Yajra\DataTables\Utilities\Helper; class DataProcessor { /** * @var int */ protected $start; /** * Columns to escape value. * * @var array */ protected $escapeColumns = []; /** * Processed data output. * * @var array */ protected $output = []; /** * @var array */ protected $appendColumns = []; /** * @var array */ protected $editColumns = []; /** * @var array */ protected $excessColumns = []; /** * @var mixed */ protected $results; /** * @var array */ protected $templates; /** * @var bool */ protected $includeIndex; /** * @var array */ protected $rawColumns; /** * @var array */ protected $exceptions = ['DT_RowId', 'DT_RowClass', 'DT_RowData', 'DT_RowAttr']; /** * @param mixed $results * @param array $columnDef * @param array $templates * @param int $start */ public function __construct($results, array $columnDef, array $templates, $start) { $this->results = $results; $this->appendColumns = $columnDef['append']; $this->editColumns = $columnDef['edit']; $this->excessColumns = $columnDef['excess']; $this->onlyColumns = $columnDef['only']; $this->escapeColumns = $columnDef['escape']; $this->includeIndex = $columnDef['index']; $this->rawColumns = $columnDef['raw']; $this->makeHidden = $columnDef['hidden']; $this->makeVisible = $columnDef['visible']; $this->templates = $templates; $this->start = $start; } /** * Process data to output on browser. * * @param bool $object * @return array */ public function process($object = false) { $this->output = []; $indexColumn = config('datatables.index_column', 'DT_RowIndex'); foreach ($this->results as $row) { $data = Helper::convertToArray($row, ['hidden' => $this->makeHidden, 'visible' => $this->makeVisible]); $value = $this->addColumns($data, $row); $value = $this->editColumns($value, $row); $value = $this->setupRowVariables($value, $row); $value = $this->selectOnlyNeededColumns($value); $value = $this->removeExcessColumns($value); if ($this->includeIndex) { $value[$indexColumn] = ++$this->start; } $this->output[] = $object ? $value : $this->flatten($value); } return $this->escapeColumns($this->output); } /** * Process add columns. * * @param mixed $data * @param mixed $row * @return array */ protected function addColumns($data, $row) { foreach ($this->appendColumns as $value) { if ($value['content'] instanceof Formatter) { $column = str_replace('_formatted', '', $value['name']); $value['content'] = $value['content']->format($data[$column], $row); } else { $value['content'] = Helper::compileContent($value['content'], $data, $row); } $data = Helper::includeInArray($value, $data); } return $data; } /** * Process edit columns. * * @param mixed $data * @param mixed $row * @return array */ protected function editColumns($data, $row) { foreach ($this->editColumns as $key => $value) { $value['content'] = Helper::compileContent($value['content'], $data, $row); Arr::set($data, $value['name'], $value['content']); } return $data; } /** * Setup additional DT row variables. * * @param mixed $data * @param mixed $row * @return array */ protected function setupRowVariables($data, $row) { $processor = new RowProcessor($data, $row); return $processor ->rowValue('DT_RowId', $this->templates['DT_RowId']) ->rowValue('DT_RowClass', $this->templates['DT_RowClass']) ->rowData('DT_RowData', $this->templates['DT_RowData']) ->rowData('DT_RowAttr', $this->templates['DT_RowAttr']) ->getData(); } /** * Get only needed columns. * * @param array $data * @return array */ protected function selectOnlyNeededColumns(array $data) { if (is_null($this->onlyColumns)) { return $data; } $results = []; foreach ($this->onlyColumns as $onlyColumn) { Arr::set($results, $onlyColumn, Arr::get($data, $onlyColumn)); } foreach ($this->exceptions as $exception) { if ($column = Arr::get($data, $exception)) { Arr::set($results, $exception, $column); } } return $results; } /** * Remove declared hidden columns. * * @param array $data * @return array */ protected function removeExcessColumns(array $data) { foreach ($this->excessColumns as $value) { Arr::forget($data, $value); } return $data; } /** * Flatten array with exceptions. * * @param array $array * @return array */ public function flatten(array $array) { $return = []; foreach ($array as $key => $value) { if (in_array($key, $this->exceptions)) { $return[$key] = $value; } else { $return[] = $value; } } return $return; } /** * Escape column values as declared. * * @param array $output * @return array */ protected function escapeColumns(array $output) { return array_map(function ($row) { if ($this->escapeColumns == '*') { $row = $this->escapeRow($row); } elseif (is_array($this->escapeColumns)) { $columns = array_diff($this->escapeColumns, $this->rawColumns); foreach ($columns as $key) { Arr::set($row, $key, e(Arr::get($row, $key))); } } return $row; }, $output); } /** * Escape all string or Htmlable values of row. * * @param array $row * @return array */ protected function escapeRow(array $row) { $arrayDot = array_filter(Arr::dot($row)); foreach ($arrayDot as $key => $value) { if (! in_array($key, $this->rawColumns)) { $arrayDot[$key] = (is_string($value) || $value instanceof Htmlable) ? e($value) : $value; } } foreach ($arrayDot as $key => $value) { Arr::set($row, $key, $value); } return $row; } } laravel-datatables-oracle/src/EloquentDataTable.php 0000644 00000017461 15021222520 0016375 0 ustar 00 <?php namespace Yajra\DataTables; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\BelongsToMany; use Illuminate\Database\Eloquent\Relations\HasOneOrMany; use Illuminate\Database\Eloquent\Relations\HasOneThrough; use Illuminate\Database\Eloquent\Relations\MorphTo; use Illuminate\Database\Eloquent\Relations\Relation; use Yajra\DataTables\Exceptions\Exception; class EloquentDataTable extends QueryDataTable { /** * @var \Illuminate\Database\Eloquent\Builder */ protected $query; /** * Can the DataTable engine be created with these parameters. * * @param mixed $source * @return bool */ public static function canCreate($source) { return $source instanceof Builder || $source instanceof Relation; } /** * EloquentEngine constructor. * * @param mixed $model */ public function __construct($model) { $builder = $model instanceof Builder ? $model : $model->getQuery(); parent::__construct($builder->getQuery()); $this->query = $builder; } /** * Add columns in collection. * * @param array $names * @param bool|int $order * @return $this */ public function addColumns(array $names, $order = false) { foreach ($names as $name => $attribute) { if (is_int($name)) { $name = $attribute; } $this->addColumn($name, function ($model) use ($attribute) { return $model->getAttribute($attribute); }, is_int($order) ? $order++ : $order); } return $this; } /** * If column name could not be resolved then use primary key. * * @return string */ protected function getPrimaryKeyName() { return $this->query->getModel()->getKeyName(); } /** * Compile query builder where clause depending on configurations. * * @param mixed $query * @param string $columnName * @param string $keyword * @param string $boolean */ protected function compileQuerySearch($query, $columnName, $keyword, $boolean = 'or') { $parts = explode('.', $columnName); $column = array_pop($parts); $relation = implode('.', $parts); if ($this->isNotEagerLoaded($relation)) { return parent::compileQuerySearch($query, $columnName, $keyword, $boolean); } if ($this->isMorphRelation($relation)) { $query->{$boolean . 'WhereHasMorph'}($relation, '*', function (Builder $query) use ($column, $keyword) { parent::compileQuerySearch($query, $column, $keyword, ''); }); } else { $query->{$boolean . 'WhereHas'}($relation, function (Builder $query) use ($column, $keyword) { parent::compileQuerySearch($query, $column, $keyword, ''); }); } } /** * Resolve the proper column name be used. * * @param string $column * @return string */ protected function resolveRelationColumn($column) { $parts = explode('.', $column); $columnName = array_pop($parts); $relation = implode('.', $parts); if ($this->isNotEagerLoaded($relation)) { return $column; } return $this->joinEagerLoadedColumn($relation, $columnName); } /** * Check if a relation is a morphed one or not. * * @param string $relation * @return bool */ protected function isMorphRelation($relation) { $isMorph = false; if ($relation !== null && $relation !== '') { $relationParts = explode('.', $relation); $firstRelation = array_shift($relationParts); $model = $this->query->getModel(); $isMorph = method_exists($model, $firstRelation) && $model->$firstRelation() instanceof MorphTo; } return $isMorph; } /** * Check if a relation was not used on eager loading. * * @param string $relation * @return bool */ protected function isNotEagerLoaded($relation) { return ! $relation || ! array_key_exists($relation, $this->query->getEagerLoads()) || $relation === $this->query->getModel()->getTable(); } /** * Join eager loaded relation and get the related column name. * * @param string $relation * @param string $relationColumn * @return string * * @throws \Yajra\DataTables\Exceptions\Exception */ protected function joinEagerLoadedColumn($relation, $relationColumn) { $table = ''; $lastQuery = $this->query; foreach (explode('.', $relation) as $eachRelation) { $model = $lastQuery->getRelation($eachRelation); switch (true) { case $model instanceof BelongsToMany: $pivot = $model->getTable(); $pivotPK = $model->getExistenceCompareKey(); $pivotFK = $model->getQualifiedParentKeyName(); $this->performJoin($pivot, $pivotPK, $pivotFK); $related = $model->getRelated(); $table = $related->getTable(); $tablePK = $related->getForeignKey(); $foreign = $pivot . '.' . $tablePK; $other = $related->getQualifiedKeyName(); $lastQuery->addSelect($table . '.' . $relationColumn); $this->performJoin($table, $foreign, $other); break; case $model instanceof HasOneThrough: $pivot = explode('.', $model->getQualifiedParentKeyName())[0]; // extract pivot table from key $pivotPK = $pivot . '.' . $model->getFirstKeyName(); $pivotFK = $model->getQualifiedLocalKeyName(); $this->performJoin($pivot, $pivotPK, $pivotFK); $related = $model->getRelated(); $table = $related->getTable(); $tablePK = $model->getSecondLocalKeyName(); $foreign = $pivot . '.' . $tablePK; $other = $related->getQualifiedKeyName(); $lastQuery->addSelect($lastQuery->getModel()->getTable().'.*'); break; case $model instanceof HasOneOrMany: $table = $model->getRelated()->getTable(); $foreign = $model->getQualifiedForeignKeyName(); $other = $model->getQualifiedParentKeyName(); break; case $model instanceof BelongsTo: $table = $model->getRelated()->getTable(); $foreign = $model->getQualifiedForeignKeyName(); $other = $model->getQualifiedOwnerKeyName(); break; default: throw new Exception('Relation ' . get_class($model) . ' is not yet supported.'); } $this->performJoin($table, $foreign, $other); $lastQuery = $model->getQuery(); } return $table . '.' . $relationColumn; } /** * Perform join query. * * @param string $table * @param string $foreign * @param string $other * @param string $type */ protected function performJoin($table, $foreign, $other, $type = 'left') { $joins = []; foreach ((array) $this->getBaseQueryBuilder()->joins as $key => $join) { $joins[] = $join->table; } if (! in_array($table, $joins)) { $this->getBaseQueryBuilder()->join($table, $foreign, '=', $other, $type); } } } laravel-datatables-oracle/src/ApiResourceDataTable.php 0000644 00000003440 15021222520 0017012 0 ustar 00 <?php namespace Yajra\DataTables; use Illuminate\Http\Resources\Json\AnonymousResourceCollection; use Illuminate\Pagination\LengthAwarePaginator; use Illuminate\Support\Collection; class ApiResourceDataTable extends CollectionDataTable { /** * Collection object. * * @var \Illuminate\Http\Resources\Json\AnonymousResourceCollection */ public $collection; /** * Collection object. * * @var \Illuminate\Http\Resources\Json\AnonymousResourceCollection */ public $original; /** * Can the DataTable engine be created with these parameters. * * @param mixed $source * @return bool */ public static function canCreate($source) { return $source instanceof AnonymousResourceCollection; } /** * Factory method, create and return an instance for the DataTable engine. * * @param \Illuminate\Http\Resources\Json\AnonymousResourceCollection $source * @return ApiResourceDataTable|DataTableAbstract */ public static function create($source) { return parent::create($source); } /** * CollectionEngine constructor. * * @param \Illuminate\Http\Resources\Json\AnonymousResourceCollection $collection */ public function __construct(AnonymousResourceCollection $collection) { $this->request = app('datatables.request'); $this->config = app('datatables.config'); $this->collection = collect($collection->toArray($this->request)); $this->original = $collection; $this->columns = array_keys($this->serialize(collect($collection->toArray($this->request))->first())); if ($collection->resource instanceof LengthAwarePaginator) { $this->isFilterApplied = true; } } } laravel-datatables-oracle/src/Contracts/DataTable.php 0000644 00000002325 15021222520 0016611 0 ustar 00 <?php namespace Yajra\DataTables\Contracts; interface DataTable { /** * Get results. * * @return mixed */ public function results(); /** * Count results. * * @return int */ public function count(); /** * Count total items. * * @return int */ public function totalCount(); /** * Set auto filter off and run your own filter. * Overrides global search. * * @param callable $callback * @param bool $globalSearch * @return $this */ public function filter(callable $callback, $globalSearch = false); /** * Perform global search. * * @return void */ public function filtering(); /** * Perform column search. * * @return void */ public function columnSearch(); /** * Perform pagination. * * @return void */ public function paging(); /** * Perform sorting of columns. * * @return void */ public function ordering(); /** * Organizes works. * * @param bool $mDataSupport * @return \Illuminate\Http\JsonResponse */ public function make($mDataSupport = true); } laravel-datatables-oracle/src/Contracts/Formatter.php 0000644 00000000316 15021222520 0016731 0 ustar 00 <?php namespace Yajra\DataTables\Contracts; interface Formatter { /** * @param mixed $value * @param mixed $row * @return string */ public function format($value, $row); } laravel-datatables-oracle/src/DataTables.php 0000644 00000007267 15021222520 0015046 0 ustar 00 <?php namespace Yajra\DataTables; use Illuminate\Support\Traits\Macroable; class DataTables { use Macroable; /** * DataTables request object. * * @var \Yajra\DataTables\Utilities\Request */ protected $request; /** * HTML builder instance. * * @var \Yajra\DataTables\Html\Builder */ protected $html; /** * Make a DataTable instance from source. * Alias of make for backward compatibility. * * @param mixed $source * @return mixed * * @throws \Exception */ public static function of($source) { return self::make($source); } /** * Make a DataTable instance from source. * * @param mixed $source * @return mixed * * @throws \Exception */ public static function make($source) { $engines = config('datatables.engines'); $builders = config('datatables.builders'); $args = func_get_args(); foreach ($builders as $class => $engine) { if ($source instanceof $class) { return call_user_func_array([$engines[$engine], 'create'], $args); } } foreach ($engines as $engine => $class) { if (call_user_func_array([$engines[$engine], 'canCreate'], $args)) { return call_user_func_array([$engines[$engine], 'create'], $args); } } throw new \Exception('No available engine for ' . get_class($source)); } /** * Get request object. * * @return \Yajra\DataTables\Utilities\Request */ public function getRequest() { return app('datatables.request'); } /** * Get config instance. * * @return \Yajra\DataTables\Utilities\Config */ public function getConfig() { return app('datatables.config'); } /** * @deprecated Please use query() instead, this method will be removed in a next version. * * @param $builder * @return QueryDataTable */ public function queryBuilder($builder) { return $this->query($builder); } /** * DataTables using Query. * * @param \Illuminate\Database\Query\Builder|mixed $builder * @return QueryDataTable|DataTableAbstract */ public function query($builder) { return QueryDataTable::create($builder); } /** * DataTables using Eloquent Builder. * * @param \Illuminate\Database\Eloquent\Builder|mixed $builder * @return EloquentDataTable|DataTableAbstract */ public function eloquent($builder) { return EloquentDataTable::create($builder); } /** * DataTables using Collection. * * @param \Illuminate\Support\Collection|array $collection * @return CollectionDataTable|DataTableAbstract */ public function collection($collection) { return CollectionDataTable::create($collection); } /** * DataTables using Collection. * * @param \Illuminate\Http\Resources\Json\AnonymousResourceCollection|array $collection * @return ApiResourceDataTable|DataTableAbstract */ public function resource($resource) { return ApiResourceDataTable::create($resource); } /** * Get html builder instance. * * @return \Yajra\DataTables\Html\Builder * * @throws \Exception */ public function getHtmlBuilder() { if (! class_exists('\Yajra\DataTables\Html\Builder')) { throw new \Exception('Please install yajra/laravel-datatables-html to be able to use this function.'); } return $this->html ?: $this->html = app('datatables.html'); } } laravel-datatables-oracle/src/DataTableAbstract.php 0000644 00000054226 15021222520 0016344 0 ustar 00 <?php namespace Yajra\DataTables; use Illuminate\Contracts\Support\Arrayable; use Illuminate\Contracts\Support\Jsonable; use Illuminate\Http\JsonResponse; use Illuminate\Support\Arr; use Illuminate\Support\Str; use Illuminate\Support\Traits\Macroable; use Psr\Log\LoggerInterface; use Yajra\DataTables\Contracts\DataTable; use Yajra\DataTables\Contracts\Formatter; use Yajra\DataTables\Processors\DataProcessor; use Yajra\DataTables\Utilities\Helper; /** * @method DataTableAbstract setTransformer($transformer) * @method DataTableAbstract setSerializer($transformer) * * @property mixed transformer * @property mixed serializer * * @see https://github.com/yajra/laravel-datatables-fractal for transformer related methods. */ abstract class DataTableAbstract implements DataTable, Arrayable, Jsonable { use Macroable; /** * DataTables Request object. * * @var \Yajra\DataTables\Utilities\Request */ public $request; /** * @var \Psr\Log\LoggerInterface */ protected $logger; /** * Array of result columns/fields. * * @var array */ protected $columns = []; /** * DT columns definitions container (add/edit/remove/filter/order/escape). * * @var array */ protected $columnDef = [ 'index' => false, 'append' => [], 'edit' => [], 'filter' => [], 'order' => [], 'only' => null, 'hidden' => [], 'visible' => [], ]; /** * Extra/Added columns. * * @var array */ protected $extraColumns = []; /** * Total records. * * @var int */ protected $totalRecords = 0; /** * Total filtered records. * * @var int */ protected $filteredRecords = 0; /** * Auto-filter flag. * * @var bool */ protected $autoFilter = true; /** * Callback to override global search. * * @var callable */ protected $filterCallback; /** * DT row templates container. * * @var array */ protected $templates = [ 'DT_RowId' => '', 'DT_RowClass' => '', 'DT_RowData' => [], 'DT_RowAttr' => [], ]; /** * [internal] Track if any filter was applied for at least one column. * * @var bool */ protected $isFilterApplied = false; /** * Custom ordering callback. * * @var callable */ protected $orderCallback; /** * Skip paginate as needed. * * @var bool */ protected $skipPaging = false; /** * Array of data to append on json response. * * @var array */ protected $appends = []; /** * @var \Yajra\DataTables\Utilities\Config */ protected $config; /** * @var mixed */ protected $serializer; /** * @var array */ protected $searchPanes = []; /** * Can the DataTable engine be created with these parameters. * * @param mixed $source * @return bool */ public static function canCreate($source) { return false; } /** * Factory method, create and return an instance for the DataTable engine. * * @param mixed $source * @return DataTableAbstract */ public static function create($source) { return new static($source); } /** * Add column in collection. * * @param string $name * @param string|callable $content * @param bool|int $order * @return $this */ public function addColumn($name, $content, $order = false) { $this->extraColumns[] = $name; $this->columnDef['append'][] = ['name' => $name, 'content' => $content, 'order' => $order]; return $this; } /** * @param string|array $columns * @param mixed|\Yajra\DataTables\Contracts\Formatter $formatter * @return $this * * @throws \Exception */ public function formatColumn($columns, $formatter) { if (is_string($formatter) && class_exists($formatter)) { $formatter = app($formatter); } if (! $formatter instanceof Formatter) { throw new \Exception('$formatter must be an instance of '. Formatter::class); } foreach ((array) $columns as $column) { $this->addColumn($column . '_formatted', $formatter); } return $this; } /** * Add DT row index column on response. * * @return $this */ public function addIndexColumn() { $this->columnDef['index'] = true; return $this; } /** * Edit column's content. * * @param string $name * @param string|callable $content * @return $this */ public function editColumn($name, $content) { $this->columnDef['edit'][] = ['name' => $name, 'content' => $content]; return $this; } /** * Remove column from collection. * * @return $this */ public function removeColumn() { $names = func_get_args(); $this->columnDef['excess'] = array_merge($this->getColumnsDefinition()['excess'], $names); return $this; } /** * Get only selected columns in response. * * @param array $columns * @return $this */ public function only(array $columns = []) { $this->columnDef['only'] = $columns; return $this; } /** * Declare columns to escape values. * * @param string|array $columns * @return $this */ public function escapeColumns($columns = '*') { $this->columnDef['escape'] = $columns; return $this; } /** * Add a makeHidden() to the row object. * * @param array $attributes * @return $this */ public function makeHidden(array $attributes = []) { $this->columnDef['hidden'] = array_merge_recursive(Arr::get($this->columnDef, 'hidden', []), $attributes); return $this; } /** * Add a makeVisible() to the row object. * * @param array $attributes * @return $this */ public function makeVisible(array $attributes = []) { $this->columnDef['visible'] = array_merge_recursive(Arr::get($this->columnDef, 'visible', []), $attributes); return $this; } /** * Set columns that should not be escaped. * Optionally merge the defaults from config. * * @param array $columns * @param bool $merge * @return $this */ public function rawColumns(array $columns, $merge = false) { if ($merge) { $config = $this->config->get('datatables.columns'); $this->columnDef['raw'] = array_merge($config['raw'], $columns); } else { $this->columnDef['raw'] = $columns; } return $this; } /** * Sets DT_RowClass template. * result: <tr class="output_from_your_template">. * * @param string|callable $content * @return $this */ public function setRowClass($content) { $this->templates['DT_RowClass'] = $content; return $this; } /** * Sets DT_RowId template. * result: <tr id="output_from_your_template">. * * @param string|callable $content * @return $this */ public function setRowId($content) { $this->templates['DT_RowId'] = $content; return $this; } /** * Set DT_RowData templates. * * @param array $data * @return $this */ public function setRowData(array $data) { $this->templates['DT_RowData'] = $data; return $this; } /** * Add DT_RowData template. * * @param string $key * @param string|callable $value * @return $this */ public function addRowData($key, $value) { $this->templates['DT_RowData'][$key] = $value; return $this; } /** * Set DT_RowAttr templates. * result: <tr attr1="attr1" attr2="attr2">. * * @param array $data * @return $this */ public function setRowAttr(array $data) { $this->templates['DT_RowAttr'] = $data; return $this; } /** * Add DT_RowAttr template. * * @param string $key * @param string|callable $value * @return $this */ public function addRowAttr($key, $value) { $this->templates['DT_RowAttr'][$key] = $value; return $this; } /** * Append data on json response. * * @param mixed $key * @param mixed $value * @return $this */ public function with($key, $value = '') { if (is_array($key)) { $this->appends = $key; } elseif (is_callable($value)) { $this->appends[$key] = value($value); } else { $this->appends[$key] = value($value); } return $this; } /** * Add with query callback value on response. * * @param string $key * @param callable $value * @return $this */ public function withQuery($key, callable $value) { $this->appends[$key] = $value; return $this; } /** * Override default ordering method with a closure callback. * * @param callable $closure * @return $this */ public function order(callable $closure) { $this->orderCallback = $closure; return $this; } /** * Update list of columns that is not allowed for search/sort. * * @param array $blacklist * @return $this */ public function blacklist(array $blacklist) { $this->columnDef['blacklist'] = $blacklist; return $this; } /** * Update list of columns that is allowed for search/sort. * * @param string|array $whitelist * @return $this */ public function whitelist($whitelist = '*') { $this->columnDef['whitelist'] = $whitelist; return $this; } /** * Set smart search config at runtime. * * @param bool $state * @return $this */ public function smart($state = true) { $this->config->set('datatables.search.smart', $state); return $this; } /** * Set starts_with search config at runtime. * * @param bool $state * @return $this */ public function startsWithSearch($state = true) { $this->config->set('datatables.search.starts_with', $state); return $this; } /** * Set multi_term search config at runtime. * * @param bool $multiTerm * @return $this */ public function setMultiTerm($multiTerm = true) { $this->config->set('datatables.search.multi_term', $multiTerm); return $this; } /** * Set total records manually. * * @param int $total * @return $this */ public function setTotalRecords($total) { $this->totalRecords = $total; return $this; } /** * Set filtered records manually. * * @param int $total * @return $this */ public function setFilteredRecords($total) { $this->filteredRecords = $total; return $this; } /** * Skip pagination as needed. * * @return $this */ public function skipPaging() { $this->skipPaging = true; return $this; } /** * Push a new column name to blacklist. * * @param string $column * @return $this */ public function pushToBlacklist($column) { if (! $this->isBlacklisted($column)) { $this->columnDef['blacklist'][] = $column; } return $this; } /** * Check if column is blacklisted. * * @param string $column * @return bool */ protected function isBlacklisted($column) { $colDef = $this->getColumnsDefinition(); if (in_array($column, $colDef['blacklist'])) { return true; } if ($colDef['whitelist'] === '*' || in_array($column, $colDef['whitelist'])) { return false; } return true; } /** * Get columns definition. * * @return array */ protected function getColumnsDefinition() { $config = $this->config->get('datatables.columns'); $allowed = ['excess', 'escape', 'raw', 'blacklist', 'whitelist']; return array_replace_recursive(Arr::only($config, $allowed), $this->columnDef); } /** * Perform sorting of columns. */ public function ordering() { if ($this->orderCallback) { return call_user_func($this->orderCallback, $this->resolveCallbackParameter()); } return $this->defaultOrdering(); } /** * Resolve callback parameter instance. * * @return mixed */ abstract protected function resolveCallbackParameter(); /** * Perform default query orderBy clause. */ abstract protected function defaultOrdering(); /** * Set auto filter off and run your own filter. * Overrides global search. * * @param callable $callback * @param bool $globalSearch * @return $this */ public function filter(callable $callback, $globalSearch = false) { $this->autoFilter = $globalSearch; $this->isFilterApplied = true; $this->filterCallback = $callback; return $this; } /** * Convert instance to array. * * @return array */ public function toArray() { return $this->make()->getData(true); } /** * Convert the object to its JSON representation. * * @param int $options * @return \Illuminate\Http\JsonResponse */ public function toJson($options = 0) { if ($options) { $this->config->set('datatables.json.options', $options); } return $this->make(); } /** * Count filtered items. * * @return int */ protected function filteredCount() { return $this->filteredRecords ? $this->filteredRecords : $this->count(); } /** * Perform necessary filters. * * @return void */ protected function filterRecords() { if ($this->autoFilter && $this->request->isSearchable()) { $this->filtering(); } if (is_callable($this->filterCallback)) { call_user_func($this->filterCallback, $this->resolveCallbackParameter()); } $this->columnSearch(); $this->searchPanesSearch(); $this->filteredRecords = $this->isFilterApplied ? $this->filteredCount() : $this->totalRecords; } /** * Perform search using search pane values. */ protected function searchPanesSearch() { // Add support for search pane. } /** * Perform global search. * * @return void */ public function filtering() { $keyword = $this->request->keyword(); if ($this->config->isMultiTerm()) { $this->smartGlobalSearch($keyword); return; } $this->globalSearch($keyword); } /** * Perform multi-term search by splitting keyword into * individual words and searches for each of them. * * @param string $keyword */ protected function smartGlobalSearch($keyword) { collect(explode(' ', $keyword)) ->reject(function ($keyword) { return trim($keyword) === ''; }) ->each(function ($keyword) { $this->globalSearch($keyword); }); } /** * Perform global search for the given keyword. * * @param string $keyword */ abstract protected function globalSearch($keyword); /** * Apply pagination. * * @return void */ protected function paginate() { if ($this->request->isPaginationable() && ! $this->skipPaging) { $this->paging(); } } /** * Transform output. * * @param mixed $results * @param mixed $processed * @return array */ protected function transform($results, $processed) { if (isset($this->transformer) && class_exists('Yajra\\DataTables\\Transformers\\FractalTransformer')) { return app('datatables.transformer')->transform( $results, $this->transformer, $this->serializer ?? null ); } return Helper::transform($processed); } /** * Get processed data. * * @param mixed $results * @param bool $object * @return array */ protected function processResults($results, $object = false) { $processor = new DataProcessor( $results, $this->getColumnsDefinition(), $this->templates, $this->request->input('start') ); return $processor->process($object); } /** * Render json response. * * @param array $data * @return \Illuminate\Http\JsonResponse */ protected function render(array $data) { $output = $this->attachAppends([ 'draw' => (int) $this->request->input('draw'), 'recordsTotal' => $this->totalRecords, 'recordsFiltered' => $this->filteredRecords, 'data' => $data, ]); if ($this->config->isDebugging()) { $output = $this->showDebugger($output); } foreach ($this->searchPanes as $column => $searchPane) { $output['searchPanes']['options'][$column] = $searchPane['options']; } return new JsonResponse( $output, 200, $this->config->get('datatables.json.header', []), $this->config->get('datatables.json.options', 0) ); } /** * Attach custom with meta on response. * * @param array $data * @return array */ protected function attachAppends(array $data) { return array_merge($data, $this->appends); } /** * Append debug parameters on output. * * @param array $output * @return array */ protected function showDebugger(array $output) { $output['input'] = $this->request->all(); return $output; } /** * Return an error json response. * * @param \Exception $exception * @return \Illuminate\Http\JsonResponse * * @throws \Yajra\DataTables\Exceptions\Exception */ protected function errorResponse(\Exception $exception) { $error = $this->config->get('datatables.error'); $debug = $this->config->get('app.debug'); if ($error === 'throw' || (! $error && ! $debug)) { throw $exception; } $this->getLogger()->error($exception); return new JsonResponse([ 'draw' => (int) $this->request->input('draw'), 'recordsTotal' => $this->totalRecords, 'recordsFiltered' => 0, 'data' => [], 'error' => $error ? __($error) : "Exception Message:\n\n".$exception->getMessage(), ]); } /** * Get monolog/logger instance. * * @return \Psr\Log\LoggerInterface */ public function getLogger() { $this->logger = $this->logger ?: app(LoggerInterface::class); return $this->logger; } /** * Set monolog/logger instance. * * @param \Psr\Log\LoggerInterface $logger * @return $this */ public function setLogger(LoggerInterface $logger) { $this->logger = $logger; return $this; } /** * Setup search keyword. * * @param string $value * @return string */ protected function setupKeyword($value) { if ($this->config->isSmartSearch()) { $keyword = '%'.$value.'%'; if ($this->config->isWildcard()) { $keyword = Helper::wildcardLikeString($value); } // remove escaping slash added on js script request $keyword = str_replace('\\', '%', $keyword); return $keyword; } return $value; } /** * Get column name to be use for filtering and sorting. * * @param int $index * @param string|null $type * @param bool $wantsAlias * @return string */ protected function getColumnName($index, $type = null, $wantsAlias = false) { $column = $this->request->columnName($index, $type); // DataTables is using make(false) if (is_numeric($column)) { $column = $this->getColumnNameByIndex($index); } if (Str::contains(Str::upper($column), ' AS ')) { $column = Helper::extractColumnName($column, $wantsAlias); } return $column; } /** * Get column name by order column index. * * @param int $index * @return string */ protected function getColumnNameByIndex($index) { $name = (isset($this->columns[$index]) && $this->columns[$index] != '*') ? $this->columns[$index] : $this->getPrimaryKeyName(); return in_array($name, $this->extraColumns, true) ? $this->getPrimaryKeyName() : $name; } /** * If column name could not be resolved then use primary key. * * @return string */ protected function getPrimaryKeyName() { return 'id'; } /** * Add a search pane options on response. * * @param string $column * @param mixed $options * @param callable|null $builder * @return $this */ public function searchPane($column, $options, callable $builder = null) { $options = value($options); if ($options instanceof Arrayable) { $options = $options->toArray(); } $this->searchPanes[$column]['options'] = $options; $this->searchPanes[$column]['builder'] = $builder; return $this; } } laravel-datatables-oracle/src/config/datatables.php 0000644 00000007475 15021222520 0016414 0 ustar 00 <?php return [ /* * DataTables search options. */ 'search' => [ /* * Smart search will enclose search keyword with wildcard string "%keyword%". * SQL: column LIKE "%keyword%" */ 'smart' => true, /* * Multi-term search will explode search keyword using spaces resulting into multiple term search. */ 'multi_term' => true, /* * Case insensitive will search the keyword in lower case format. * SQL: LOWER(column) LIKE LOWER(keyword) */ 'case_insensitive' => true, /* * Wild card will add "%" in between every characters of the keyword. * SQL: column LIKE "%k%e%y%w%o%r%d%" */ 'use_wildcards' => false, /* * Perform a search which starts with the given keyword. * SQL: column LIKE "keyword%" */ 'starts_with' => false, ], /* * DataTables internal index id response column name. */ 'index_column' => 'DT_RowIndex', /* * List of available builders for DataTables. * This is where you can register your custom dataTables builder. */ 'engines' => [ 'eloquent' => Yajra\DataTables\EloquentDataTable::class, 'query' => Yajra\DataTables\QueryDataTable::class, 'collection' => Yajra\DataTables\CollectionDataTable::class, 'resource' => Yajra\DataTables\ApiResourceDataTable::class, ], /* * DataTables accepted builder to engine mapping. * This is where you can override which engine a builder should use * Note, only change this if you know what you are doing! */ 'builders' => [ //Illuminate\Database\Eloquent\Relations\Relation::class => 'eloquent', //Illuminate\Database\Eloquent\Builder::class => 'eloquent', //Illuminate\Database\Query\Builder::class => 'query', //Illuminate\Support\Collection::class => 'collection', ], /* * Nulls last sql pattern for PostgreSQL & Oracle. * For MySQL, use 'CASE WHEN :column IS NULL THEN 1 ELSE 0 END, :column :direction' */ 'nulls_last_sql' => ':column :direction NULLS LAST', /* * User friendly message to be displayed on user if error occurs. * Possible values: * null - The exception message will be used on error response. * 'throw' - Throws a \Yajra\DataTables\Exceptions\Exception. Use your custom error handler if needed. * 'custom message' - Any friendly message to be displayed to the user. You can also use translation key. */ 'error' => env('DATATABLES_ERROR', null), /* * Default columns definition of dataTable utility functions. */ 'columns' => [ /* * List of columns hidden/removed on json response. */ 'excess' => ['rn', 'row_num'], /* * List of columns to be escaped. If set to *, all columns are escape. * Note: You can set the value to empty array to disable XSS protection. */ 'escape' => '*', /* * List of columns that are allowed to display html content. * Note: Adding columns to list will make us available to XSS attacks. */ 'raw' => ['action'], /* * List of columns are forbidden from being searched/sorted. */ 'blacklist' => ['password', 'remember_token'], /* * List of columns that are only allowed fo search/sort. * If set to *, all columns are allowed. */ 'whitelist' => '*', ], /* * JsonResponse header and options config. */ 'json' => [ 'header' => [], 'options' => 0, ], ]; laravel-datatables-oracle/src/QueryDataTable.php 0000644 00000050771 15021222520 0015707 0 ustar 00 <?php namespace Yajra\DataTables; use Illuminate\Database\Eloquent\Builder as EloquentBuilder; use Illuminate\Database\Query\Builder; use Illuminate\Database\Query\Expression; use Illuminate\Support\Str; use Yajra\DataTables\Utilities\Helper; class QueryDataTable extends DataTableAbstract { /** * Builder object. * * @var \Illuminate\Database\Query\Builder */ protected $query; /** * Database connection used. * * @var \Illuminate\Database\Connection */ protected $connection; /** * Flag for ordering NULLS LAST option. * * @var bool */ protected $nullsLast = false; /** * Flag to check if query preparation was already done. * * @var bool */ protected $prepared = false; /** * Query callback for custom pagination using limit without offset. * * @var callable */ protected $limitCallback; /** * Flag to skip total records count query. * * @var bool */ protected $skipTotalRecords = false; /** * Flag to keep the select bindings. * * @var bool */ protected $keepSelectBindings = false; /** * Can the DataTable engine be created with these parameters. * * @param mixed $source * @return bool */ public static function canCreate($source) { return $source instanceof Builder; } /** * @param \Illuminate\Database\Query\Builder $builder */ public function __construct(Builder $builder) { $this->query = $builder; $this->request = app('datatables.request'); $this->config = app('datatables.config'); $this->columns = $builder->columns; $this->connection = $builder->getConnection(); if ($this->config->isDebugging()) { $this->connection->enableQueryLog(); } } /** * Organizes works. * * @param bool $mDataSupport * @return \Illuminate\Http\JsonResponse * * @throws \Exception */ public function make($mDataSupport = true) { try { $this->prepareQuery(); $results = $this->results(); $processed = $this->processResults($results, $mDataSupport); $data = $this->transform($results, $processed); return $this->render($data); } catch (\Exception $exception) { return $this->errorResponse($exception); } } /** * Perform search using search pane values. */ protected function searchPanesSearch() { $columns = $this->request->get('searchPanes', []); foreach ($columns as $column => $values) { if ($this->isBlacklisted($column)) { continue; } if ($this->searchPanes[$column] && $callback = $this->searchPanes[$column]['builder']) { $callback($this->query, $values); } else { $this->query->whereIn($column, $values); } $this->isFilterApplied = true; } } /** * Prepare query by executing count, filter, order and paginate. */ protected function prepareQuery() { if (! $this->prepared) { $this->totalRecords = $this->totalCount(); if ($this->totalRecords) { $this->filterRecords(); } $this->ordering(); $this->paginate(); } $this->prepared = true; } /** * Skip total records and set the recordsTotal equals to recordsFiltered. * This will improve the performance by skipping the total count query. * * @return $this */ public function skipTotalRecords() { $this->skipTotalRecords = true; return $this; } /** * Keep the select bindings. * * @return $this */ public function keepSelectBindings() { $this->keepSelectBindings = true; return $this; } /** * Count total items. * * @return int */ public function totalCount() { if ($this->skipTotalRecords) { $this->isFilterApplied = true; return 1; } return $this->totalRecords ? $this->totalRecords : $this->count(); } /** * Count filtered items. * * @return int */ protected function filteredCount() { $this->filteredRecords = $this->filteredRecords ?: $this->count(); if ($this->skipTotalRecords) { $this->totalRecords = $this->filteredRecords; } return $this->filteredRecords; } /** * Counts current query. * * @return int */ public function count() { return $this->prepareCountQuery()->count(); } /** * Prepare count query builder. * * @return \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Query\Builder */ public function prepareCountQuery() { $builder = clone $this->query; if ($this->isComplexQuery($builder)) { $table = $this->connection->raw('('.$builder->toSql().') count_row_table'); return $this->connection->table($table) ->setBindings($builder->getBindings()); } $row_count = $this->wrap('row_count'); $builder->select($this->connection->raw("'1' as {$row_count}")); if (! $this->keepSelectBindings) { $builder->setBindings([], 'select'); } return $builder; } /** * Check if builder query uses complex sql. * * @param \Illuminate\Database\Query\Builder $builder * @return bool */ protected function isComplexQuery($builder) { return Str::contains(Str::lower($builder->toSql()), ['union', 'having', 'distinct', 'order by', 'group by']); } /** * Wrap column with DB grammar. * * @param string $column * @return string */ protected function wrap($column) { return $this->connection->getQueryGrammar()->wrap($column); } /** * Get paginated results. * * @return \Illuminate\Support\Collection */ public function results() { return $this->query->get(); } /** * Get filtered, ordered and paginated query. * * @return \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Query\Builder */ public function getFilteredQuery() { $this->prepareQuery(); return $this->getQuery(); } /** * Get query builder instance. * * @return \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Query\Builder */ public function getQuery() { return $this->query; } /** * Perform column search. * * @return void */ public function columnSearch() { $columns = $this->request->columns(); foreach ($columns as $index => $column) { $column = $this->getColumnName($index); if (! $this->request->isColumnSearchable($index) || $this->isBlacklisted($column) && ! $this->hasFilterColumn($column)) { continue; } if ($this->hasFilterColumn($column)) { $keyword = $this->getColumnSearchKeyword($index, true); $this->applyFilterColumn($this->getBaseQueryBuilder(), $column, $keyword); } else { $column = $this->resolveRelationColumn($column); $keyword = $this->getColumnSearchKeyword($index); $this->compileColumnSearch($index, $column, $keyword); } $this->isFilterApplied = true; } } /** * Check if column has custom filter handler. * * @param string $columnName * @return bool */ public function hasFilterColumn($columnName) { return isset($this->columnDef['filter'][$columnName]); } /** * Get column keyword to use for search. * * @param int $i * @param bool $raw * @return string */ protected function getColumnSearchKeyword($i, $raw = false) { $keyword = $this->request->columnKeyword($i); if ($raw || $this->request->isRegex($i)) { return $keyword; } return $this->setupKeyword($keyword); } /** * Apply filterColumn api search. * * @param mixed $query * @param string $columnName * @param string $keyword * @param string $boolean */ protected function applyFilterColumn($query, $columnName, $keyword, $boolean = 'and') { $query = $this->getBaseQueryBuilder($query); $callback = $this->columnDef['filter'][$columnName]['method']; if ($this->query instanceof EloquentBuilder) { $builder = $this->query->newModelInstance()->newQuery(); } else { $builder = $this->query->newQuery(); } $callback($builder, $keyword); $query->addNestedWhereQuery($this->getBaseQueryBuilder($builder), $boolean); } /** * Get the base query builder instance. * * @param mixed $instance * @return \Illuminate\Database\Query\Builder */ protected function getBaseQueryBuilder($instance = null) { if (! $instance) { $instance = $this->query; } if ($instance instanceof EloquentBuilder) { return $instance->getQuery(); } return $instance; } /** * Resolve the proper column name be used. * * @param string $column * @return string */ protected function resolveRelationColumn($column) { return $column; } /** * Compile queries for column search. * * @param int $i * @param string $column * @param string $keyword */ protected function compileColumnSearch($i, $column, $keyword) { if ($this->request->isRegex($i)) { $this->regexColumnSearch($column, $keyword); } else { $this->compileQuerySearch($this->query, $column, $keyword, ''); } } /** * Compile regex query column search. * * @param mixed $column * @param string $keyword */ protected function regexColumnSearch($column, $keyword) { $column = $this->wrap($column); switch ($this->connection->getDriverName()) { case 'oracle': $sql = ! $this->config->isCaseInsensitive() ? 'REGEXP_LIKE( ' . $column . ' , ? )' : 'REGEXP_LIKE( LOWER(' . $column . ') , ?, \'i\' )'; break; case 'pgsql': $column = $this->castColumn($column); $sql = ! $this->config->isCaseInsensitive() ? $column . ' ~ ?' : $column . ' ~* ? '; break; default: $sql = ! $this->config->isCaseInsensitive() ? $column . ' REGEXP ?' : 'LOWER(' . $column . ') REGEXP ?'; $keyword = Str::lower($keyword); } $this->query->whereRaw($sql, [$keyword]); } /** * Wrap a column and cast based on database driver. * * @param string $column * @return string */ protected function castColumn($column) { switch ($this->connection->getDriverName()) { case 'pgsql': return 'CAST(' . $column . ' as TEXT)'; case 'firebird': return 'CAST(' . $column . ' as VARCHAR(255))'; default: return $column; } } /** * Compile query builder where clause depending on configurations. * * @param mixed $query * @param string $column * @param string $keyword * @param string $boolean */ protected function compileQuerySearch($query, $column, $keyword, $boolean = 'or') { $column = $this->addTablePrefix($query, $column); $column = $this->castColumn($column); $sql = $column . ' LIKE ?'; if ($this->config->isCaseInsensitive()) { $sql = 'LOWER(' . $column . ') LIKE ?'; } $query->{$boolean . 'WhereRaw'}($sql, [$this->prepareKeyword($keyword)]); } /** * Patch for fix about ambiguous field. * Ambiguous field error will appear when query use join table and search with keyword. * * @param mixed $query * @param string $column * @return string */ protected function addTablePrefix($query, $column) { if (strpos($column, '.') === false) { $q = $this->getBaseQueryBuilder($query); if (! $q->from instanceof Expression) { $column = $q->from . '.' . $column; } } return $this->wrap($column); } /** * Prepare search keyword based on configurations. * * @param string $keyword * @return string */ protected function prepareKeyword($keyword) { if ($this->config->isStartsWithSearch()) { return "$keyword%"; } if ($this->config->isCaseInsensitive()) { $keyword = Str::lower($keyword); } if ($this->config->isWildcard()) { $keyword = Helper::wildcardLikeString($keyword); } if ($this->config->isSmartSearch()) { $keyword = "%$keyword%"; } return $keyword; } /** * Add custom filter handler for the give column. * * @param string $column * @param callable $callback * @return $this */ public function filterColumn($column, callable $callback) { $this->columnDef['filter'][$column] = ['method' => $callback]; return $this; } /** * Order each given columns versus the given custom sql. * * @param array $columns * @param string $sql * @param array $bindings * @return $this */ public function orderColumns(array $columns, $sql, $bindings = []) { foreach ($columns as $column) { $this->orderColumn($column, str_replace(':column', $column, $sql), $bindings); } return $this; } /** * Override default column ordering. * * @param string $column * @param string|\Closure $sql * @param array $bindings * @return $this * * @internal string $1 Special variable that returns the requested order direction of the column. */ public function orderColumn($column, $sql, $bindings = []) { $this->columnDef['order'][$column] = compact('sql', 'bindings'); return $this; } /** * Set datatables to do ordering with NULLS LAST option. * * @return $this */ public function orderByNullsLast() { $this->nullsLast = true; return $this; } /** * Paginate dataTable using limit without offset * with additional where clause via callback. * * @param callable $callback * @return $this */ public function limit(callable $callback) { $this->limitCallback = $callback; return $this; } /** * Perform pagination. * * @return void */ public function paging() { $limit = (int) $this->request->input('length') > 0 ? $this->request->input('length') : 10; if (is_callable($this->limitCallback)) { $this->query->limit($limit); call_user_func_array($this->limitCallback, [$this->query]); } else { $this->query->skip($this->request->input('start'))->take($limit); } } /** * Add column in collection. * * @param string $name * @param string|callable $content * @param bool|int $order * @return $this */ public function addColumn($name, $content, $order = false) { $this->pushToBlacklist($name); return parent::addColumn($name, $content, $order); } /** * Resolve callback parameter instance. * * @return \Illuminate\Database\Query\Builder */ protected function resolveCallbackParameter() { return $this->query; } /** * Perform default query orderBy clause. */ protected function defaultOrdering() { collect($this->request->orderableColumns()) ->map(function ($orderable) { $orderable['name'] = $this->getColumnName($orderable['column'], null, true); return $orderable; }) ->reject(function ($orderable) { return $this->isBlacklisted($orderable['name']) && ! $this->hasOrderColumn($orderable['name']); }) ->each(function ($orderable) { $column = $this->resolveRelationColumn($orderable['name']); if ($this->hasOrderColumn($column)) { $this->applyOrderColumn($column, $orderable); } else { $nullsLastSql = $this->getNullsLastSql($column, $orderable['direction']); $normalSql = $this->wrap($column) . ' ' . $orderable['direction']; $sql = $this->nullsLast ? $nullsLastSql : $normalSql; $this->query->orderByRaw($sql); } }); } /** * Check if column has custom sort handler. * * @param string $column * @return bool */ protected function hasOrderColumn($column) { return isset($this->columnDef['order'][$column]); } /** * Apply orderColumn custom query. * * @param string $column * @param array $orderable */ protected function applyOrderColumn($column, $orderable) { $sql = $this->columnDef['order'][$column]['sql']; if ($sql === false) { return; } if (is_callable($sql)) { call_user_func($sql, $this->query, $orderable['direction']); } else { $sql = str_replace('$1', $orderable['direction'], $sql); $bindings = $this->columnDef['order'][$column]['bindings']; $this->query->orderByRaw($sql, $bindings); } } /** * Get NULLS LAST SQL. * * @param string $column * @param string $direction * @return string */ protected function getNullsLastSql($column, $direction) { $sql = $this->config->get('datatables.nulls_last_sql', '%s %s NULLS LAST'); return str_replace( [':column', ':direction'], [$column, $direction], sprintf($sql, $column, $direction) ); } /** * Perform global search for the given keyword. * * @param string $keyword */ protected function globalSearch($keyword) { $this->query->where(function ($query) use ($keyword) { collect($this->request->searchableColumnIndex()) ->map(function ($index) { return $this->getColumnName($index); }) ->reject(function ($column) { return $this->isBlacklisted($column) && ! $this->hasFilterColumn($column); }) ->each(function ($column) use ($keyword, $query) { if ($this->hasFilterColumn($column)) { $this->applyFilterColumn($query, $column, $keyword, 'or'); } else { $this->compileQuerySearch($query, $column, $keyword); } $this->isFilterApplied = true; }); }); } /** * Append debug parameters on output. * * @param array $output * @return array */ protected function showDebugger(array $output) { $query_log = $this->connection->getQueryLog(); array_walk_recursive($query_log, function (&$item) { if (is_string($item)) { $item = utf8_encode($item); } }); $output['queries'] = $query_log; $output['input'] = $this->request->all(); return $output; } /** * Attach custom with meta on response. * * @param array $data * @return array */ protected function attachAppends(array $data) { $appends = []; foreach ($this->appends as $key => $value) { if (is_callable($value)) { $appends[$key] = value($value($this->getFilteredQuery())); } else { $appends[$key] = $value; } } return array_merge($data, $appends); } } laravel-datatables-oracle/src/CollectionDataTable.php 0000644 00000022605 15021222520 0016670 0 ustar 00 <?php namespace Yajra\DataTables; use Illuminate\Contracts\Support\Arrayable; use Illuminate\Support\Arr; use Illuminate\Support\Collection; use Illuminate\Support\Str; class CollectionDataTable extends DataTableAbstract { /** * Collection object. * * @var \Illuminate\Support\Collection */ public $collection; /** * Collection object. * * @var \Illuminate\Support\Collection */ public $original; /** * The offset of the first record in the full dataset. * * @var int */ private $offset = 0; /** * Can the DataTable engine be created with these parameters. * * @param mixed $source * @return bool */ public static function canCreate($source) { return is_array($source) || $source instanceof Collection; } /** * Factory method, create and return an instance for the DataTable engine. * * @param array|\Illuminate\Support\Collection $source * @return CollectionDataTable|DataTableAbstract */ public static function create($source) { if (is_array($source)) { $source = new Collection($source); } return parent::create($source); } /** * CollectionEngine constructor. * * @param \Illuminate\Support\Collection $collection */ public function __construct(Collection $collection) { $this->request = app('datatables.request'); $this->config = app('datatables.config'); $this->collection = $collection; $this->original = $collection; $this->columns = array_keys($this->serialize($collection->first())); } /** * Serialize collection. * * @param mixed $collection * @return mixed|null */ protected function serialize($collection) { return $collection instanceof Arrayable ? $collection->toArray() : (array) $collection; } /** * Count results. * * @return int */ public function count() { return $this->collection->count() > $this->totalRecords ? $this->totalRecords : $this->collection->count(); } /** * Perform column search. * * @return void */ public function columnSearch() { $columns = $this->request->get('columns', []); for ($i = 0, $c = count($columns); $i < $c; $i++) { $column = $this->getColumnName($i, 'filter'); if (! $this->request->isColumnSearchable($i) || $this->isBlacklisted($column)) { continue; } $this->isFilterApplied = true; $regex = $this->request->isRegex($i); $keyword = $this->request->columnKeyword($i); $this->collection = $this->collection->filter( function ($row) use ($column, $keyword, $regex) { $data = $this->serialize($row); $value = Arr::get($data, $column); if ($this->config->isCaseInsensitive()) { if ($regex) { return preg_match('/' . $keyword . '/i', $value) == 1; } return strpos(Str::lower($value), Str::lower($keyword)) !== false; } if ($regex) { return preg_match('/' . $keyword . '/', $value) == 1; } return strpos($value, $keyword) !== false; } ); } } /** * Perform pagination. * * @return void */ public function paging() { $this->collection = $this->collection->slice( $this->request->input('start') - $this->offset, (int) $this->request->input('length') > 0 ? $this->request->input('length') : 10 ); } /** * Organizes works. * * @param bool $mDataSupport * @return \Illuminate\Http\JsonResponse */ public function make($mDataSupport = true) { try { $this->totalRecords = $this->totalCount(); if ($this->totalRecords) { $results = $this->results(); $processed = $this->processResults($results, $mDataSupport); $output = $this->transform($results, $processed); $this->collection = collect($output); $this->ordering(); $this->filterRecords(); $this->paginate(); $this->revertIndexColumn($mDataSupport); } return $this->render($this->collection->values()->all()); } catch (\Exception $exception) { return $this->errorResponse($exception); } } /** * Count total items. * * @return int */ public function totalCount() { return $this->totalRecords ? $this->totalRecords : $this->collection->count(); } /** * Get results. * * @return mixed */ public function results() { return $this->collection->all(); } /** * Revert transformed DT_RowIndex back to it's original values. * * @param bool $mDataSupport */ private function revertIndexColumn($mDataSupport) { if ($this->columnDef['index']) { $index = $mDataSupport ? config('datatables.index_column', 'DT_RowIndex') : 0; $start = (int) $this->request->input('start'); $this->collection->transform(function ($data) use ($index, &$start) { $data[$index] = ++$start; return $data; }); } } /** * Perform global search for the given keyword. * * @param string $keyword */ protected function globalSearch($keyword) { $keyword = $this->config->isCaseInsensitive() ? Str::lower($keyword) : $keyword; $this->collection = $this->collection->filter(function ($row) use ($keyword) { $this->isFilterApplied = true; $data = $this->serialize($row); foreach ($this->request->searchableColumnIndex() as $index) { $column = $this->getColumnName($index, 'sort'); $value = Arr::get($data, $column); if (! $value || is_array($value)) { if (! is_numeric($value)) { continue; } $value = (string) $value; } $value = $this->config->isCaseInsensitive() ? Str::lower($value) : $value; if (Str::contains($value, $keyword)) { return true; } } return false; }); } /** * Perform default query orderBy clause. */ protected function defaultOrdering() { $criteria = $this->request->orderableColumns(); if (! empty($criteria)) { $sorter = $this->getSorter($criteria); $this->collection = $this->collection ->map(function ($data) { return Arr::dot($data); }) ->sort($sorter) ->map(function ($data) { foreach ($data as $key => $value) { unset($data[$key]); Arr::set($data, $key, $value); } return $data; }); } } /** * Get array sorter closure. * * @param array $criteria * @return \Closure */ protected function getSorter(array $criteria) { $sorter = function ($a, $b) use ($criteria) { foreach ($criteria as $orderable) { $column = $this->getColumnName($orderable['column'], 'sort'); $direction = $orderable['direction']; if ($direction === 'desc') { $first = $b; $second = $a; } else { $first = $a; $second = $b; } if (is_numeric($first[$column] ?? null) && is_numeric($second[$column] ?? null)) { if ($first[$column] < $second[$column]) { $cmp = -1; } elseif ($first[$column] > $second[$column]) { $cmp = 1; } else { $cmp = 0; } } elseif ($this->config->isCaseInsensitive()) { $cmp = strnatcasecmp($first[$column] ?? null, $second[$column] ?? null); } else { $cmp = strnatcmp($first[$column] ?? null, $second[$column] ?? null); } if ($cmp != 0) { return $cmp; } } // all elements were equal return 0; }; return $sorter; } /** * Resolve callback parameter instance. * * @return $this */ protected function resolveCallbackParameter() { return $this; } /** * Define the offset of the first item of the collection with respect to * the FULL dataset the collection was sliced from. It effectively allows the * collection to be "pre-sliced". * * @param int $offset * @return $this */ public function setOffset(int $offset) { $this->offset = $offset; return $this; } } laravel-datatables-oracle/src/DataTablesServiceProvider.php 0000644 00000004126 15021222520 0020071 0 ustar 00 <?php namespace Yajra\DataTables; use Illuminate\Support\ServiceProvider; use Illuminate\Support\Str; use Yajra\DataTables\Utilities\Config; use Yajra\DataTables\Utilities\Request; class DataTablesServiceProvider extends ServiceProvider { /** * Register the service provider. * * @return void */ public function register() { if ($this->isLumen()) { require_once 'lumen.php'; } $this->setupAssets(); $this->app->alias('datatables', DataTables::class); $this->app->singleton('datatables', function () { return new DataTables; }); $this->app->singleton('datatables.request', function () { return new Request; }); $this->app->singleton('datatables.config', Config::class); } /** * Boot the instance, add macros for datatable engines. * * @return void */ public function boot() { $engines = (array) config('datatables.engines'); foreach ($engines as $engine => $class) { $engine = Str::camel($engine); if (! method_exists(DataTables::class, $engine) && ! DataTables::hasMacro($engine)) { DataTables::macro($engine, function () use ($class) { if (! call_user_func_array([$class, 'canCreate'], func_get_args())) { throw new \InvalidArgumentException(); } return call_user_func_array([$class, 'create'], func_get_args()); }); } } } /** * Setup package assets. * * @return void */ protected function setupAssets() { $this->mergeConfigFrom($config = __DIR__ . '/config/datatables.php', 'datatables'); if ($this->app->runningInConsole()) { $this->publishes([$config => config_path('datatables.php')], 'datatables'); } } /** * Check if app uses Lumen. * * @return bool */ protected function isLumen() { return Str::contains($this->app->version(), 'Lumen'); } } laravel-datatables-oracle/README.md 0000644 00000012370 15021222520 0013010 0 ustar 00 # jQuery DataTables API for Laravel 4|5|6|7|8|9 [](https://gitter.im/yajra/laravel-datatables?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [](https://www.paypal.me/yajra) [](https://www.patreon.com/bePatron?u=4521203) [](http://laravel.com) [](https://packagist.org/packages/yajra/laravel-datatables-oracle) [](https://packagist.org/packages/yajra/laravel-datatables-oracle)  [](https://scrutinizer-ci.com/g/yajra/laravel-datatables/?branch=master) [](https://packagist.org/packages/yajra/laravel-datatables-oracle) [](https://packagist.org/packages/yajra/laravel-datatables-oracle) This package is created to handle [server-side](https://www.datatables.net/manual/server-side) works of [DataTables](http://datatables.net) jQuery Plugin via [AJAX option](https://datatables.net/reference/option/ajax) by using Eloquent ORM, Fluent Query Builder or Collection. ```php return datatables()->of(User::query())->toJson(); return datatables()->of(DB::table('users'))->toJson(); return datatables()->of(User::all())->toJson(); return datatables()->eloquent(User::query())->toJson(); return datatables()->query(DB::table('users'))->toJson(); return datatables()->collection(User::all())->toJson(); return datatables(User::query())->toJson(); return datatables(DB::table('users'))->toJson(); return datatables(User::all())->toJson(); ``` ## Requirements - [PHP >= 7.1](http://php.net/) - [Laravel 4.2|5.x|6|7|8|9](https://github.com/laravel/framework) - [jQuery DataTables v1.10.x](http://datatables.net/) ## Documentations - [Github Docs](https://github.com/yajra/laravel-datatables-docs) - [Laravel DataTables Quick Starter](https://yajrabox.com/docs/laravel-datatables/master/quick-starter) - [Laravel DataTables Documentation](https://yajrabox.com/docs/laravel-datatables) - [Laravel 5.0 - 5.3 Demo Application](https://datatables.yajrabox.com) **NOTE: Documentation links below are currently offline.** - [Laravel 5.4 Demo Application](http://dt54.yajrabox.com) ## Laravel Version Compatibility Laravel | Package :---------|:---------- 4.2.x | 3.x 5.0.x | 6.x 5.1.x | 6.x 5.2.x | 6.x 5.3.x | 6.x 5.4.x | 7.x, 8.x 5.5.x | 8.x 5.6.x | 8.x 5.7.x | 8.x 5.8.x | 9.x 6.x.x | 9.x 7.x.x | 9.x 8.x.x | 9.x 9.x.x | 9.x ## DataTables 8.x Upgrade Guide There are breaking changes since DataTables v8.x. If you are upgrading from v7.x to v8.x, please see [upgrade guide](https://yajrabox.com/docs/laravel-datatables/master/upgrade). ## Quick Installation ```bash $ composer require yajra/laravel-datatables-oracle:"~9.0" ``` #### Service Provider & Facade (Optional on Laravel 5.5+) Register provider and facade on your `config/app.php` file. ```php 'providers' => [ ..., Yajra\DataTables\DataTablesServiceProvider::class, ] 'aliases' => [ ..., 'DataTables' => Yajra\DataTables\Facades\DataTables::class, ] ``` #### Configuration (Optional) ```bash $ php artisan vendor:publish --provider="Yajra\DataTables\DataTablesServiceProvider" ``` And that's it! Start building out some awesome DataTables! ## Debugging Mode To enable debugging mode, just set `APP_DEBUG=true` and the package will include the queries and inputs used when processing the table. **IMPORTANT:** Please make sure that APP_DEBUG is set to false when your app is on production. ## PHP ARTISAN SERVE BUG Please avoid using `php artisan serve` when developing with the package. There are known bugs when using this where Laravel randomly returns a redirect and 401 (Unauthorized) if the route requires authentication and a 404 NotFoundHttpException on valid routes. It is advised to use [Homestead](https://laravel.com/docs/5.4/homestead) or [Valet](https://laravel.com/docs/5.4/valet) when working with the package. ## Contributing Please see [CONTRIBUTING](https://github.com/yajra/laravel-datatables/blob/master/.github/CONTRIBUTING.md) for details. ## Security If you discover any security related issues, please email [aqangeles@gmail.com](mailto:aqangeles@gmail.com) instead of using the issue tracker. ## Credits - [Arjay Angeles](https://github.com/yajra) - [bllim/laravel4-datatables-package](https://github.com/bllim/laravel4-datatables-package) - [All Contributors](https://github.com/yajra/laravel-datatables/graphs/contributors) ## License The MIT License (MIT). Please see [License File](https://github.com/yajra/laravel-datatables/blob/master/LICENSE.md) for more information. laravel-datatables-oracle/CONDUCT.md 0000644 00000011734 15021222520 0013155 0 ustar 00 # Contributor Covenant Code of Conduct ## Our Pledge We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation. We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community. ## Our Standards Examples of behavior that contributes to a positive environment for our community include: * Demonstrating empathy and kindness toward other people * Being respectful of differing opinions, viewpoints, and experiences * Giving and gracefully accepting constructive feedback * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience * Focusing on what is best not just for us as individuals, but for the overall community Examples of unacceptable behavior include: * The use of sexualized language or imagery, and sexual attention or advances of any kind * Trolling, insulting or derogatory comments, and personal or political attacks * Public or private harassment * Publishing others’ private information, such as a physical or email address, without their explicit permission * Other conduct which could reasonably be considered inappropriate in a professional setting ## Enforcement Responsibilities Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful. Community leaders 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, and will communicate reasons for moderation decisions when appropriate. ## Scope This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at [INSERT CONTACT METHOD]. All complaints will be reviewed and investigated promptly and fairly. All community leaders are obligated to respect the privacy and security of the reporter of any incident. ## Enforcement Guidelines Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct: ### 1. Correction Community Impact: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community. Consequence: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested. ### 2. Warning Community Impact: A violation through a single incident or series of actions. Consequence: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban. ### 3. Temporary Ban Community Impact: A serious violation of community standards, including sustained inappropriate behavior. Consequence: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban. ### 4. Permanent Ban Community Impact: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. Consequence: A permanent ban from any sort of public interaction within the community. ## Attribution This Code of Conduct is adapted from the Contributor Covenant, version 2.1, available at https://www.contributor-covenant.org/version/2/1/code_of_conduct.html. Community Impact Guidelines were inspired by Mozilla’s code of conduct enforcement ladder. For answers to common questions about this code of conduct, see the FAQ at https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
| ver. 1.4 |
Github
|
.
| PHP 8.1.29 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка