UUIDs everywhere

UUIDs are safer than using regular numeric IDs because they are not easy to spoof.

Something that has been 'bugging' me from the beginning: all the numeric id's everywhere. Why does it bug me? Good question, but its probably because my mind starts to or tries to recognize these as patterns. Until I migrate:fresh the database and things are reset again.

Anyway, it's one of those things that were on the list to be fixed anyway, because it's a potential security risk anyway and users might deduct certain conclusions based on ids (I certainly do on other sites)

    public function servers()
    {
        return $this->belongsToMany(Server::class, 'server_site', 'server_id', 'site_id')
            ->using(new class extends Pivot {
                use HasUuids;
            });
    }

Thanks to solid tests, the implementation is a breeze. The only thing that needed some attention was the UUID generation in pivot tables without a model. As Laravel is endlessly flexible this neat piece of code quickly fixes that.

Done

  • Implemented UUIDs everywhere
  • Extended even more tests