From cb3654a54f86bf4b6c17bd892fd78637f7b3703d Mon Sep 17 00:00:00 2001 From: Yoga Pangestu Date: Sat, 23 Nov 2024 10:35:32 +0700 Subject: [PATCH] chore: install yajra datatable,hash id,laravel notify and cascade soft delete --- composer.json | 18 +++- composer.lock | 207 +++++++++++++++++++++++++++++++++++++++++- config/datatables.php | 127 ++++++++++++++++++++++++++ 3 files changed, 348 insertions(+), 4 deletions(-) create mode 100644 config/datatables.php diff --git a/composer.json b/composer.json index faf772e..1072528 100644 --- a/composer.json +++ b/composer.json @@ -2,14 +2,20 @@ "name": "laravel/laravel", "type": "project", "description": "The skeleton application for the Laravel framework.", - "keywords": ["laravel", "framework"], + "keywords": [ + "laravel", + "framework" + ], "license": "MIT", "require": { "php": "^8.2", "biscolab/laravel-recaptcha": "^6.1", + "dyrynda/laravel-cascade-soft-deletes": "^4.4", + "hashids/hashids": "^5.0", "laravel/framework": "^11.9", "laravel/tinker": "^2.9", - "mckenziearts/laravel-notify": "^2.5" + "mckenziearts/laravel-notify": "^2.5", + "yajra/laravel-datatables-oracle": "^11.0" }, "require-dev": { "fakerphp/faker": "^1.23", @@ -25,7 +31,13 @@ "App\\": "app/", "Database\\Factories\\": "database/factories/", "Database\\Seeders\\": "database/seeders/" - } + }, + "files": [ + "app/Helpers/date_helpers.php", + "app/Helpers/encryption_helpers.php", + "app/Helpers/setting_helpers.php", + "app/Helpers/string_helpers.php" + ] }, "autoload-dev": { "psr-4": { diff --git a/composer.lock b/composer.lock index 7c35282..81d9219 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "69b4211969f0ad57380a0caf4b963f20", + "content-hash": "1bff0cd19b9529d4bede864e11ca549e", "packages": [ { "name": "biscolab/laravel-recaptcha", @@ -515,6 +515,53 @@ ], "time": "2024-10-09T13:47:03+00:00" }, + { + "name": "dyrynda/laravel-cascade-soft-deletes", + "version": "4.4.0", + "source": { + "type": "git", + "url": "https://github.com/michaeldyrynda/laravel-cascade-soft-deletes.git", + "reference": "467aa81143aebd63c58cc508578b137c52ee1590" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/michaeldyrynda/laravel-cascade-soft-deletes/zipball/467aa81143aebd63c58cc508578b137c52ee1590", + "reference": "467aa81143aebd63c58cc508578b137c52ee1590", + "shasum": "" + }, + "require": { + "illuminate/database": "^10.0 || ^11.0", + "illuminate/events": "^10.0 || ^11.0", + "php": "^8.1" + }, + "require-dev": { + "pestphp/pest": "^2.34", + "pestphp/pest-plugin-drift": "^2.5" + }, + "type": "utility", + "autoload": { + "psr-4": { + "Dyrynda\\Database\\Support\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dyrynda", + "email": "michael@dyrynda.com.au", + "homepage": "https://dyrynda.com.au" + } + ], + "description": "Cascading deletes for Eloquent models that implement soft deletes", + "support": { + "issues": "https://github.com/michaeldyrynda/laravel-cascade-soft-deletes/issues", + "source": "https://github.com/michaeldyrynda/laravel-cascade-soft-deletes/tree/4.4.0" + }, + "time": "2024-03-18T23:17:38+00:00" + }, { "name": "egulias/email-validator", "version": "4.0.2", @@ -1126,6 +1173,75 @@ ], "time": "2023-12-03T19:50:20+00:00" }, + { + "name": "hashids/hashids", + "version": "5.0.2", + "source": { + "type": "git", + "url": "https://github.com/vinkla/hashids.git", + "reference": "197171016b77ddf14e259e186559152eb3f8cf33" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/vinkla/hashids/zipball/197171016b77ddf14e259e186559152eb3f8cf33", + "reference": "197171016b77ddf14e259e186559152eb3f8cf33", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "php": "^8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.0" + }, + "suggest": { + "ext-bcmath": "Required to use BC Math arbitrary precision mathematics (*).", + "ext-gmp": "Required to use GNU multiple precision mathematics (*)." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + }, + "autoload": { + "psr-4": { + "Hashids\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ivan Akimov", + "email": "ivan@barreleye.com" + }, + { + "name": "Vincent Klaiber", + "email": "hello@doubledip.se" + } + ], + "description": "Generate short, unique, non-sequential ids (like YouTube and Bitly) from numbers", + "homepage": "https://hashids.org/php", + "keywords": [ + "bitly", + "decode", + "encode", + "hash", + "hashid", + "hashids", + "ids", + "obfuscate", + "youtube" + ], + "support": { + "issues": "https://github.com/vinkla/hashids/issues", + "source": "https://github.com/vinkla/hashids/tree/5.0.2" + }, + "time": "2023-02-23T15:00:54+00:00" + }, { "name": "laravel/framework", "version": "v11.31.0", @@ -5754,6 +5870,95 @@ "source": "https://github.com/webmozarts/assert/tree/1.11.0" }, "time": "2022-06-03T18:03:27+00:00" + }, + { + "name": "yajra/laravel-datatables-oracle", + "version": "v11.1.5", + "source": { + "type": "git", + "url": "https://github.com/yajra/laravel-datatables.git", + "reference": "158f2e9cf76d500c707a0ebd6cd2079cd87b8d4a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yajra/laravel-datatables/zipball/158f2e9cf76d500c707a0ebd6cd2079cd87b8d4a", + "reference": "158f2e9cf76d500c707a0ebd6cd2079cd87b8d4a", + "shasum": "" + }, + "require": { + "illuminate/database": "^11", + "illuminate/filesystem": "^11", + "illuminate/http": "^11", + "illuminate/support": "^11", + "illuminate/view": "^11", + "php": "^8.2" + }, + "require-dev": { + "algolia/algoliasearch-client-php": "^3.4.1", + "larastan/larastan": "^2.9.1", + "laravel/pint": "^1.14", + "laravel/scout": "^10.8.3", + "meilisearch/meilisearch-php": "^1.6.1", + "orchestra/testbench": "^9", + "rector/rector": "^1.0" + }, + "suggest": { + "yajra/laravel-datatables-buttons": "Plugin for server-side exporting of dataTables.", + "yajra/laravel-datatables-editor": "Plugin to use DataTables Editor (requires a license).", + "yajra/laravel-datatables-export": "Plugin for server-side exporting using livewire and queue worker.", + "yajra/laravel-datatables-fractal": "Plugin for server-side response using Fractal.", + "yajra/laravel-datatables-html": "Plugin for server-side HTML builder of dataTables." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "11.x-dev" + }, + "laravel": { + "providers": [ + "Yajra\\DataTables\\DataTablesServiceProvider" + ], + "aliases": { + "DataTables": "Yajra\\DataTables\\Facades\\DataTables" + } + } + }, + "autoload": { + "files": [ + "src/helper.php" + ], + "psr-4": { + "Yajra\\DataTables\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Arjay Angeles", + "email": "aqangeles@gmail.com" + } + ], + "description": "jQuery DataTables API for Laravel", + "keywords": [ + "datatables", + "jquery", + "laravel", + "yajra" + ], + "support": { + "issues": "https://github.com/yajra/laravel-datatables/issues", + "source": "https://github.com/yajra/laravel-datatables/tree/v11.1.5" + }, + "funding": [ + { + "url": "https://github.com/sponsors/yajra", + "type": "github" + } + ], + "time": "2024-08-26T01:43:52+00:00" } ], "packages-dev": [ diff --git a/config/datatables.php b/config/datatables.php new file mode 100644 index 0000000..0891264 --- /dev/null +++ b/config/datatables.php @@ -0,0 +1,127 @@ + [ + /* + * 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, + ], + + /* + * Default condition to determine if a parameter is a callback or not. + * Callbacks needs to start by those terms, or they will be cast to string. + */ + 'callback' => ['$', '$.', 'function'], +];