Open roshani3110 opened 4 years ago
Hey,
Can you share your group model & migration and the config/friendships.php
file.
-TT
config/friendships.php
`<?php
return [
'tables' => [
'fr_pivot' => 'connections',
'fr_groups_pivot' => 'user_connection_groups'
],
'groups' => [
'acquaintances' => 0,
'close_friends' => 1,
'family' => 2
]
];`
Migration:-
`class CreateFriendshipsGroupsTable extends Migration {
public function up() {
Schema::create(config('friendships.tables.fr_groups_pivot'), function (Blueprint $table) {
$table->integer('friendship_id')->unsigned();
$table->morphs('friend');
$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');
});
}
public function down() {
Schema::dropIfExists(config('friendships.tables.fr_groups_pivot'));
}
}`
Does the group title you are retrieving from $group->title
match the group names used in the config/friendship.php
file?
-TT
nope, also i tried this -> $user->getFriends($perPage = 20, 'family'); but didn't work. it returns empty array.
and one question - Does this package supports a 6.8 laravel version and 7.2 php version?
Hello,
Requirement :- to fetch friends of a specific group and I have used getFriends($perPage = 20, $group_name) method.
Problem :- getFriends($perPage = 20, $group_name) returns all friends of application and also getFriendsCount($group_name) returns count of all friends of application. can you please help me?
Here is code:
foreach ($groups as $group) { $group_name = $group->title; $group_connections = $user->getFriends($perPage = 20, $group_name); }
Thanks in advance!