mirror of
https://github.com/rico-vz/HeimerdingerLoL.git
synced 2025-12-06 10:10:48 +01:00
feat: implement sqids
This commit is contained in:
@@ -4,6 +4,7 @@ namespace App\Models;
|
||||
|
||||
use Cviebrock\EloquentSluggable\Sluggable;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Sqids\Sqids;
|
||||
|
||||
class SummonerIcon extends Model
|
||||
{
|
||||
@@ -29,8 +30,14 @@ class SummonerIcon extends Model
|
||||
{
|
||||
return [
|
||||
'slug' => [
|
||||
'source' => ['title', 'icon_id'],
|
||||
'source' => ['title', 'sqid'],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public function getSqidAttribute(): string
|
||||
{
|
||||
$sqids = new Sqids(minLength: 5);
|
||||
return $sqids->encode([$this->icon_id]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,8 @@
|
||||
"laravel/tinker": "^2.8",
|
||||
"saade/blade-iconsax": "^1.1",
|
||||
"spatie/laravel-backup": "^8.3",
|
||||
"spatie/laravel-query-builder": "^5.6"
|
||||
"spatie/laravel-query-builder": "^5.6",
|
||||
"sqids/sqids": "^0.4.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"barryvdh/laravel-debugbar": "^3.9",
|
||||
|
||||
57
composer.lock
generated
57
composer.lock
generated
@@ -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": "6bfadf87b8450cc61e25f15f00688ecd",
|
||||
"content-hash": "9c8af349d513fd5bcda4506d673f1a7c",
|
||||
"packages": [
|
||||
{
|
||||
"name": "andcarpi/laravel-popper",
|
||||
@@ -4328,6 +4328,61 @@
|
||||
],
|
||||
"time": "2023-09-25T07:13:36+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sqids/sqids",
|
||||
"version": "0.4.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sqids/sqids-php.git",
|
||||
"reference": "ff3d1214c0c2119ae4b676cc00f3abb22f61da42"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sqids/sqids-php/zipball/ff3d1214c0c2119ae4b676cc00f3abb22f61da42",
|
||||
"reference": "ff3d1214c0c2119ae4b676cc00f3abb22f61da42",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^8.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^10.3"
|
||||
},
|
||||
"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-main": "1.0-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Sqids\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"description": "Generate short YouTube-looking IDs from numbers",
|
||||
"homepage": "https://sqids.org/php",
|
||||
"keywords": [
|
||||
"decode",
|
||||
"encode",
|
||||
"generate",
|
||||
"hashids",
|
||||
"ids",
|
||||
"sqids"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/sqids/sqids-php/issues",
|
||||
"source": "https://github.com/sqids/sqids-php/tree/0.4.1"
|
||||
},
|
||||
"time": "2023-09-12T22:30:42+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/cache",
|
||||
"version": "v6.3.8",
|
||||
|
||||
Reference in New Issue
Block a user