Removed unnecessary comments and updated UserSeeder

This commit is contained in:
Kamil Niemczycki 2022-04-19 14:45:17 +02:00
parent 37783b0077
commit f0fae39614
10 changed files with 17 additions and 120 deletions

View File

@ -7,33 +7,13 @@ use Illuminate\Support\Str;
class UserFactory extends Factory class UserFactory extends Factory
{ {
/** public function definition(): array
* Define the model's default state.
*
* @return array
*/
public function definition()
{ {
return [ return [
'name' => $this->faker->name(), 'name' => $this->faker->name(),
'email' => $this->faker->unique()->safeEmail(), 'email' => $this->faker->unique()->safeEmail(),
'email_verified_at' => now(),
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
'remember_token' => Str::random(10), 'remember_token' => Str::random(10),
]; ];
} }
/**
* Indicate that the model's email address should be unverified.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
public function unverified()
{
return $this->state(function (array $attributes) {
return [
'email_verified_at' => null,
];
});
}
} }

View File

@ -6,30 +6,19 @@ use Illuminate\Support\Facades\Schema;
class CreateUsersTable extends Migration class CreateUsersTable extends Migration
{ {
/** public function up(): void
* Run the migrations.
*
* @return void
*/
public function up()
{ {
Schema::create('users', function (Blueprint $table) { Schema::create('users', function (Blueprint $table) {
$table->id(); $table->id();
$table->string('name'); $table->string('name');
$table->string('email')->unique(); $table->string('email')->unique();
// $table->timestamp('email_verified_at')->nullable();
$table->string('password'); $table->string('password');
$table->rememberToken(); $table->rememberToken();
$table->timestamps(); $table->timestamps();
}); });
} }
/** public function down(): void
* Reverse the migrations.
*
* @return void
*/
public function down()
{ {
Schema::dropIfExists('users'); Schema::dropIfExists('users');
} }

View File

@ -6,12 +6,7 @@ use Illuminate\Support\Facades\Schema;
class CreatePasswordResetsTable extends Migration class CreatePasswordResetsTable extends Migration
{ {
/** public function up(): void
* Run the migrations.
*
* @return void
*/
public function up()
{ {
Schema::create('password_resets', function (Blueprint $table) { Schema::create('password_resets', function (Blueprint $table) {
$table->string('email')->index(); $table->string('email')->index();
@ -20,12 +15,7 @@ class CreatePasswordResetsTable extends Migration
}); });
} }
/** public function down(): void
* Reverse the migrations.
*
* @return void
*/
public function down()
{ {
Schema::dropIfExists('password_resets'); Schema::dropIfExists('password_resets');
} }

View File

@ -6,12 +6,7 @@ use Illuminate\Support\Facades\Schema;
class CreateFailedJobsTable extends Migration class CreateFailedJobsTable extends Migration
{ {
/** public function up(): void
* Run the migrations.
*
* @return void
*/
public function up()
{ {
Schema::create('failed_jobs', function (Blueprint $table) { Schema::create('failed_jobs', function (Blueprint $table) {
$table->id(); $table->id();
@ -24,12 +19,7 @@ class CreateFailedJobsTable extends Migration
}); });
} }
/** public function down(): void
* Reverse the migrations.
*
* @return void
*/
public function down()
{ {
Schema::dropIfExists('failed_jobs'); Schema::dropIfExists('failed_jobs');
} }

View File

@ -6,12 +6,7 @@ use Illuminate\Support\Facades\Schema;
class CreatePersonalAccessTokensTable extends Migration class CreatePersonalAccessTokensTable extends Migration
{ {
/** public function up(): void
* Run the migrations.
*
* @return void
*/
public function up()
{ {
Schema::create('personal_access_tokens', function (Blueprint $table) { Schema::create('personal_access_tokens', function (Blueprint $table) {
$table->id(); $table->id();
@ -24,12 +19,7 @@ class CreatePersonalAccessTokensTable extends Migration
}); });
} }
/** public function down(): void
* Reverse the migrations.
*
* @return void
*/
public function down()
{ {
Schema::dropIfExists('personal_access_tokens'); Schema::dropIfExists('personal_access_tokens');
} }

View File

@ -6,12 +6,7 @@ use Illuminate\Support\Facades\Schema;
class CreateCategoriesTable extends Migration class CreateCategoriesTable extends Migration
{ {
/** public function up(): void
* Run the migrations.
*
* @return void
*/
public function up()
{ {
Schema::create('categories', function (Blueprint $table) { Schema::create('categories', function (Blueprint $table) {
$table->id(); $table->id();
@ -24,12 +19,7 @@ class CreateCategoriesTable extends Migration
}); });
} }
/** public function down(): void
* Reverse the migrations.
*
* @return void
*/
public function down()
{ {
Schema::dropIfExists('categories'); Schema::dropIfExists('categories');
} }

View File

@ -8,13 +8,7 @@ use Illuminate\Support\Facades\Schema;
class CreateProjectsTable extends Migration class CreateProjectsTable extends Migration
{ {
public function up(): void
/**
* Run the migrations.
*
* @return void
*/
public function up()
{ {
Schema::create('projects', function (Blueprint $table) { Schema::create('projects', function (Blueprint $table) {
$table->id(); $table->id();
@ -32,12 +26,7 @@ class CreateProjectsTable extends Migration
}); });
} }
/** public function down(): void
* Reverse the migrations.
*
* @return void
*/
public function down()
{ {
Schema::dropIfExists('projects'); Schema::dropIfExists('projects');
} }

View File

@ -7,12 +7,7 @@ use Illuminate\Database\Seeder;
class CategorySeeder extends Seeder class CategorySeeder extends Seeder
{ {
/** public function run(): void
* Run the database seeds.
*
* @return void
*/
public function run()
{ {
$categories = [ $categories = [
['name' => 'Wszystkie', 'slug' => 'all', 'default' => true, 'visible' => true], ['name' => 'Wszystkie', 'slug' => 'all', 'default' => true, 'visible' => true],

View File

@ -6,14 +6,8 @@ use Illuminate\Database\Seeder;
class DatabaseSeeder extends Seeder class DatabaseSeeder extends Seeder
{ {
/** public function run(): void
* Seed the application's database.
*
* @return void
*/
public function run()
{ {
// \App\Models\User::factory(10)->create();
$this->call(CategorySeeder::class); $this->call(CategorySeeder::class);
$this->call(UserSeeder::class); $this->call(UserSeeder::class);
} }

View File

@ -8,18 +8,8 @@ use Illuminate\Support\Facades\Hash;
class UserSeeder extends Seeder class UserSeeder extends Seeder
{ {
/** public function run(): void
* Run the database seeds.
*
* @return void
*/
public function run()
{ {
User::query() User::factory(['email' => 'admin@admin.pl'])->create();
->create([
'name' => 'Kamil Niemczycki',
'email' => 'admin@admin.pl',
'password' => Hash::make('password123^')
]);
} }
} }