Possible solutions :
Solution :
1) Go to the path in your Laravel installation
or to see the default Laravel installation file AppServiceProvider.php
go here
https://github.com/laravel/laravel/blob/master/app/Providers/AppServiceProvider.php
In your file AppServiceProvider.php
will see the method boot()
2) Simply update boot() method as like below:
5) Use a Different Character Set:
If using utf8mb4 is not mandatory, switching to a character set that requires fewer bytes per character, like utf8, can also resolve the issue. However, this may not be suitable for all applications, especially those that need to store a wide variety of international characters.
3) Change the Database Engine:
- If altering the column length is not feasible or desirable, another approach is to switch to a database engine that supports larger index sizes. For MySQL, upgrading to version 5.7.7 or higher allows for the use of the innodb_large_prefix option, which increases the maximum index length to 3072 bytes.
4) Modify the Server Configuration:
For those who cannot upgrade MySQL or change the engine, modifying the MySQL or MariaDB server configuration can provide a workaround. Setting the innodb_file_format to Barracuda and innodb_large_prefix to 1 in the server's my.cnf file can help overcome this limitation.