1. Go to this page and download the library: Download ghanem/friendship-filament library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
ghanem / friendship-filament example snippets
use Ghanem\FriendshipFilament\FriendshipPlugin;
public function panel(Panel $panel): Panel
{
return $panel->plugin(FriendshipPlugin::make());
}
'models' => [
\App\Models\User::class => [
'label' => 'name', // see label forms below
'resource' => \App\Filament\Resources\UserResource::class, // optional deep link
],
],
'fallback_label' => null, // used before the "Type #id" default; same forms as 'label'
'deleted_label' => 'Deleted record',
'navigation_group' => null,
'navigation_sort' => null,
namespace App\Support;
class UserLabel
{
public function __invoke(\App\Models\User $user): string
{
return $user->first_name.' '.$user->last_name;
}
}
use Ghanem\FriendshipFilament\RelationManagers\FriendsRelationManager;
public static function getRelations(): array
{
return [
FriendsRelationManager::class,
];
}
FriendshipPlugin::make()
->navigationGroup('Community')
->navigationSort(3) // 0 is valid and sorts first
->widgets(false) // skip the dashboard widgets
->resource(false); // skip the Resource, keep the relation manager