mirror of
https://github.com/rico-vz/HeimerdingerLoL.git
synced 2025-12-06 18:20: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]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user