Laravel Migration Error: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes

Migration error on Laravel 5.4 with php artisan make:auth [Illuminate\Database\QueryException] SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes (SQL: alter tabl e users add unique users_email_unique(email)) [PDOException] SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes … Read more

Laravel: How to Get Current Route Name? (v5 … v7)

In Laravel v4 I was able to get the current route name using… Route::currentRouteName() How can I do it in Laravel v5 and Laravel v6? 32 Answers 32 Try this Route::getCurrentRoute()->getPath(); or \Request::route()->getName() from v5.1 use Illuminate\Support\Facades\Route; $currentPath= Route::getFacadeRoot()->current()->uri(); Laravel v5.2 Route::currentRouteName(); //use Illuminate\Support\Facades\Route; Or if you need the action name Route::getCurrentRoute()->getActionName(); Laravel 5.2 route … Read more

Laravel Migration Change to Make a Column Nullable

I created a migration with unsigned user_id. How can I edit user_id in a new migration to also make it nullable()? Schema::create(‘throttle’, function(Blueprint $table) { $table->increments(‘id’); // this needs to also be nullable, how should the next migration be? $table->integer(‘user_id’)->unsigned(); } 11 Answers 11

Laravel 5 – artisan seed [ReflectionException] Class SongsTableSeeder does not exist

When I run php artisan db:seed I am getting the following error: [ReflectionException] Class SongsTableSeeder does not exist What is going on? My DatabaseSeeder class: <?php use Illuminate\Database\Seeder; use Illuminate\Database\Eloquent\Model; class DatabaseSeeder extends Seeder { /** * Run the database seeds. * * @return void */ public function run() { Model::unguard(); $this->call(‘SongsTableSeeder’); } } My … Read more

No Application Encryption Key Has Been Specified

I’m new to Laravel and I’m trying to use the Artisan command… php artisan serve It displays… Laravel development server started: http://127.0.0.1:8000 However, it won’t automatically launch and when I manually enter http://127.0.0.1:8000 it shows this error: RuntimeException No application encryption key has been specified. Any ideas? I’m using Laravel framework 5.5-dev. 24 Answers 24