Something is just with you password, I am not sure right, but maybe it depends on key in .env file.
Apr 24, 2020
3
Level 1
Seeder User authentication
Hi All,
Sorry to bother you all constantly at the moment. I've just moved to AWS and finally managed to set it up however I can't seem to connect to the database through the ssh at the moment for some bizarre reason so figured I could create my admin user through a factory and seeder. The database does get seeded however when I come to login it says that the credentials are invalid.
User Factory
<?php
/** @var \Illuminate\Database\Eloquent\Factory $factory */
use App\User;
use Faker\Generator as Faker;
use Illuminate\Support\Str;
$factory->define(User::class, function (Faker $faker) {
return [
'name' => 'admin',
'email' => '[email protected]',
'email_verified_at' => now(),
'password' => 'yIXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
'bio' => $faker->userName,
'experience' => $faker->userName,
'years_played' => $faker->numberBetween(0,10),
'gear' => $faker->userName,
'userlevel' => 'admin',
'avatar' => 'uploads/avatars/default.jpg',
'remember_token' => Str::random(10),
];
});
User Seeder
<?php
use Illuminate\Database\Seeder;
use App\User;
class UserSeeder extends Seeder
{
public function run()
{
Factory(User::class, 1) -> create();
}
}
Main Seeder
<?php
use Illuminate\Database\Seeder;
class DatabaseSeeder extends Seeder
{
public function run()
{
$this->call(UserSeeder::class);
}
}
User Migration
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateUsersTable extends Migration
{
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->string('bio');
$table->string('experience')->default('beginner');
$table->integer('years_played')->default('0');
$table->string('gear');
$table->string('userlevel');
$table->string('avatar')->default('uploads/avatars/default.jpg');
$table->rememberToken();
$table->timestamps();
});
}
public function down()
{
Schema::dropIfExists('users');
}
}
Any help on this would be brilliant!
Thanks for looking, Ben
Please or to participate in this conversation.