›
›
›
  1. docs
  2. ›
  3. byrcsc/laravel-mentions
1.x
Browse documentationOpenClose

Getting started

  • Introduction
  • Installation and setup
  • Quick start

Core concepts

  • Mention records
  • Parsing text
  • Resolving targets
  • Synchronization

Operations

  • Scan multiple attributes
  • Use markup mentions
  • Mention groups
  • Querying mentions
  • React to lifecycle events
  • Control synchronization
  • Extend the package

Reference

  • Configuration
  • Public API
  • Published assets
  • Testing
  • Troubleshooting

Getting started

  • Introduction
  • Installation and setup
  • Quick start

Core concepts

  • Mention records
  • Parsing text
  • Resolving targets
  • Synchronization

Operations

  • Scan multiple attributes
  • Use markup mentions
  • Mention groups
  • Querying mentions
  • React to lifecycle events
  • Control synchronization
  • Extend the package

Reference

  • Configuration
  • Public API
  • Published assets
  • Testing
  • Troubleshooting

byrcsc/laravel-mentions · 1.x

Published assets.

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.

Configuration asset

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.

Migration asset

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 migrate

Table schema

The migration creates:

ColumnTypeNullable
idDatabase primary keyno
source_typeString, 191 charactersno
source_idString, 191 charactersno
target_typeString, 191 charactersno
target_idString, 191 charactersno
handleStringyes
created_atTimestampyes
updated_atTimestampyes

It also creates:

  • mentions_source_index on source type and ID;
  • mentions_target_index on target type and ID; and
  • mentions_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.

Custom table names

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.

Rollback behavior

The migration's down() method drops the configured table name:

php artisan migrate:rollback

Keep the configuration value unchanged until the rollback completes.

What to read next

  • Installation and setup for the publish order.
  • Mention records for the meaning of each column.
  • Configuration for custom model and table settings.
PreviousPublic APINextTesting
View source

On this page

  1. Configuration asset
  2. Migration asset
  3. Table schema
  4. Custom table names
  5. Rollback behavior
  6. What to read next