Here few steps how to create relation tables using UUID instead auto-increment id
use $table->uuid('id')->primary();
instead of $table->id();
in parent table migration
use $table->foreignUuid('user_id')->constrained();
instead of $table->foreignId('user_id')->constrained();
in child table migration
In the parent table model: Add the HasUuids
trait at the beginning of the model class to enable UUID handling:
use Illuminate\Database\Eloquent\Concerns\HasUuids;
class ParentModel extends Model
{
use HasUuids;
}
source: Link