Using Stripe-like, human-readable IDs in Laravel Models and Migrations. This will fully use Stripe-like IDs (like "usr_123123123" or "team_123123123") instead of auto-incrementing IDs or UUIDs in your models.
- In your migrations, change
$table->id();
to$table->string('id')->primary();
- Add the new
HasHashIds
trait toapp/Traits/HasHashIds.php
<?php
namespace App\Traits;