What does index () mean in Laravel?

I have this code $table->integer('card_id')->unsigned()->index(); in the table I created using the Laravel framework. Just to see what index() does?

+6
source share
1 answer

This is a way to tell Laravel Migration to add indexes to this column to get faster results when searching for that particular column.

This is a general procedure in database design when building tables. Just β€œindex” some specific columns if you plan on doing a table search using these columns.

I realized that you added the "indexing" tag to your question and that the description of this tag answers your question.

+12
source

All Articles