Closed antweny closed 5 years ago
Hey, are you eliminating id's from your user's table entirely? Why do you wan't to use UUID instead? Just trying to understand the use case and benefit of it here?
Morph method is simply shortcut for {name}_id
and {name}_type
. But for id
it takes bigInteger
. We need uuid
field type.
Schema::create(config('friendships.tables.fr_pivot'), function (Blueprint $table) {
$table->increments('id');
$table->string('sender_type');
$table->uuid('sender_id');
$table->string('recipient_type');
$table->uuid('recipient_id');
$table->tinyInteger('status')->default(0);
$table->timestamps();
});
and
Schema::create(config('friendships.tables.fr_groups_pivot'), function (Blueprint $table) {
$table->integer('friendship_id')->unsigned();
$table->string('friend_type');
$table->uuid('friend_id');
$table->integer('group_id')->unsigned();
$table->foreign('friendship_id')
->references('id')
->on(config('friendships.tables.fr_pivot'))
->onDelete('cascade');
$table->unique(['friendship_id', 'friend_id', 'friend_type', 'group_id'], 'unique');
});
I want to use UUID in this package.
On Friendship migration file should i change like this
And on friendships groupd i changed like this
how do i deal with morphs data type....