1. Go to this page and download the library: Download asmit/filament-mention 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/ */
asmit / filament-mention example snippets
return [
'mentionable' => [
'model' => \App\Models\User::class, // The model to use for mentions
'column' => [
'id' => 'id', // Unique identifier for the user
'display_name' => 'name', // Display name for the mention
'username' => 'username', // Username for the mention
'avatar' => 'profile', // Avatar field (e.g. profile picture URL)
],
'url' => 'admin/users/{id}', // this will be used to generate the url for the mention item
'lookup_key' => 'username', // Used for static search (key in the dataset)
'search_key' => 'username', // Used for dynamic search (database column)
],
'default' => [
'trigger_with' => ['@', '#', '%'], // Characters to trigger mentions
'trigger_configs' => [
'@' => [
'prefix' => '',
'suffix' => '',
'title_field' => 'name',
'hint_field' => null,
],
'#' => [
'prefix' => '',
'suffix' => '',
'title_field' => 'name',
'hint_field' => null,
],
'%' => [
'prefix' => '%',
'suffix' => '%',
'title_field' => 'title',
'hint_field' => null,
],
],
'menu_show_min_length' => 0, // Minimum characters to type before showing suggestions
'menu_item_limit' => 10, // Maximum number of suggestions to display
'prefix' => '', // Default prefix for all mentions
'suffix' => '', // Default suffix for all mentions
'title_field' => 'title', // Default field to use for title display
'hint_field' => null, // Default field to use for hint display
],
];
use Asmit\Mention\Forms\Components\RichMentionEditor;
RichMentionEditor::make('bio')
->columnSpanFull(),