Laravel error Specified Key was a too long error
This tutorial is for Laravel error Specified Key was a too long error.
Laravel Specified Key was a too-long error if your database table varchar type is 191 set. edit AppServiceProvider.php file and inside the boot.
Edit your AppServiceProvider.php(app/Providers/AppServiceProvider.php) file and inside the boot, the method set a default string length:
#app/Providers/AppServiceProvider.php <?php namespace App\Providers; use Illuminate\Support\ServiceProvider; use Illuminate\Support\Facades\Schema; //added class AppServiceProvider extends ServiceProvider { /** * Register any application services. * * @return void */ public function register() { // } /** * Bootstrap any application services. * * @return void */ public function boot() { Schema::defaultStringLength(191); // Update defaultStringLength } }