›
byrcsc/laravel-mentions · 1.x
Publish the package configuration and the migration that creates the mentions table.
Laravel Mentions publishes one configuration file and one migration. It does not publish views, routes, translations, JavaScript, or CSS.
Publish config/mentions.php:
php artisan vendor:publish --tag="mentions-config"Publishing again does not overwrite an existing file unless you pass Laravel's
--force option. Review local changes before forcing an update.
Publish the timestamped create_mentions_table migration:
php artisan vendor:publish --tag="mentions-migrations"Run it with the rest of your application migrations:
php artisan migrateThe migration creates:
| Column | Type | Nullable |
|---|---|---|
id | Database primary key | no |
source_type | String, 191 characters | no |
source_id | String, 191 characters | no |
target_type | String, 191 characters | no |
target_id | String, 191 characters | no |
handle | String | yes |
created_at | Timestamp | yes |
updated_at | Timestamp | yes |
It also creates:
mentions_source_index on source type and ID;mentions_target_index on target type and ID; andmentions_source_target_unique across both morph identities.The morph columns are strings so UUID and ULID keys round-trip without schema changes. Their 191-character limit keeps the four-column unique index within portable database index sizes.
Set mentions.table before publishing or running the migration:
'table' => 'model_mentions',The migration and Mention::getTable() both read that key. Changing it after
the migration has run requires an application migration that renames the table.
The migration's down() method drops the configured table name:
php artisan migrate:rollbackKeep the configuration value unchanged until the rollback completes.