getting error on table create on database migration in laravel

your error can be something like this:- Syntax error or access violation:1071 Specified key was too long; max key length is 767 bytes 

if you facing problem in creating table using database migration in laravel
then follow the steps:-

  1. Go to app -> Providers -> Edit AppServiceProvider.php
  2. Add given below line after use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Schema;

     3. add this line Schema::defaultStringLength(191);  in this given below function


   public function boot()
    {
        
    }

Now you can run your database migration by this command 😅

php artisan migrate

Popular posts from this blog

How to open cPanel using WHM access.

Cant use dump() function in twig files or how to enable debug in opencart twig or print_r alternate use dump() in opencart 3.0