Skip to content

Commit

Permalink
Merge pull request #576 from nasirkhan/dev
Browse files Browse the repository at this point in the history
File manager and encode id updated
  • Loading branch information
nasirkhan authored May 1, 2024
2 parents 502ef59 + 0607b61 commit 7d6e2e4
Show file tree
Hide file tree
Showing 14 changed files with 431 additions and 413 deletions.
2 changes: 1 addition & 1 deletion app/Http/Controllers/Backend/BackendBaseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function index()

$module_action = 'List';

$$module_name = $module_model::paginate();
$$module_name = $module_model::paginate(15);

logUserAccess($module_title.' '.$module_action);

Expand Down
16 changes: 8 additions & 8 deletions app/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,36 +200,36 @@ function humanFilesize($size, $precision = 2)

/*
*
* Encode Id to a Hashids\Hashids
* Encode Id to a Hashids / Sqids
*
* ------------------------------------------------------------------------
*/
if (! function_exists('encode_id')) {
/**
* Prepare the Column Name for Lables.
* Encode Id to a Hashids / Sqids.
*/
function encode_id($id)
{
$hashids = new Hashids\Hashids(config('app.salt'), 3, 'abcdefghijklmnopqrstuvwxyz1234567890');
$sqids = new Sqids\Sqids(alphabet: 'abcdefghijklmnopqrstuvwxyz123456789');

return $hashids->encode($id);
return $sqids->encode([$id]);
}
}

/*
*
* Decode Id to a Hashids\Hashids
* Decode Id from Hashids / Sqids
*
* ------------------------------------------------------------------------
*/
if (! function_exists('decode_id')) {
/**
* Prepare the Column Name for Lables.
* Decode Id from Hashids / Sqids.
*/
function decode_id($hashid)
{
$hashids = new Hashids\Hashids(config('app.salt'), 3, 'abcdefghijklmnopqrstuvwxyz1234567890');
$id = $hashids->decode($hashid);
$sqids = new Sqids\Sqids(alphabet: 'abcdefghijklmnopqrstuvwxyz123456789');
$id = $sqids->decode($hashid);

if (count($id)) {
return $id[0];
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"require": {
"php": "^8.2",
"arcanedev/log-viewer": "^11.0",
"hashids/hashids": "^5.0",
"intervention/image-laravel": "^1.2",
"laracasts/flash": "^3.2",
"laravel/framework": "^11.0",
Expand All @@ -29,6 +28,7 @@
"spatie/laravel-html": "^3.6",
"spatie/laravel-medialibrary": "^11.4",
"spatie/laravel-permission": "^6.4",
"sqids/sqids": "^0.4.1",
"unisharp/laravel-filemanager": "^2.9",
"yajra/laravel-datatables-oracle": "^11.0"
},
Expand Down
Loading

0 comments on commit 7d6e2e4

Please sign in to comment.