From f0fae396140f888f937a2c6efc60fa6bbdfa5bf1 Mon Sep 17 00:00:00 2001 From: Kamil Niemczycki Date: Tue, 19 Apr 2022 14:45:17 +0200 Subject: [PATCH] Removed unnecessary comments and updated UserSeeder --- database/factories/UserFactory.php | 22 +------------------ .../2014_10_12_000000_create_users_table.php | 15 ++----------- ...12_100000_create_password_resets_table.php | 14 ++---------- ..._08_19_000000_create_failed_jobs_table.php | 14 ++---------- ...01_create_personal_access_tokens_table.php | 14 ++---------- ...2_02_08_114741_create_categories_table.php | 14 ++---------- ...022_02_09_075749_create_projects_table.php | 15 ++----------- database/seeders/CategorySeeder.php | 7 +----- database/seeders/DatabaseSeeder.php | 8 +------ database/seeders/UserSeeder.php | 14 ++---------- 10 files changed, 17 insertions(+), 120 deletions(-) diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.php index a3eb239..e4f8189 100644 --- a/database/factories/UserFactory.php +++ b/database/factories/UserFactory.php @@ -7,33 +7,13 @@ use Illuminate\Support\Str; class UserFactory extends Factory { - /** - * Define the model's default state. - * - * @return array - */ - public function definition() + public function definition(): array { return [ 'name' => $this->faker->name(), 'email' => $this->faker->unique()->safeEmail(), - 'email_verified_at' => now(), 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password '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, - ]; - }); - } } diff --git a/database/migrations/2014_10_12_000000_create_users_table.php b/database/migrations/2014_10_12_000000_create_users_table.php index cec6493..a00feba 100644 --- a/database/migrations/2014_10_12_000000_create_users_table.php +++ b/database/migrations/2014_10_12_000000_create_users_table.php @@ -6,30 +6,19 @@ use Illuminate\Support\Facades\Schema; class CreateUsersTable extends Migration { - /** - * Run the migrations. - * - * @return void - */ - public function up() + public function up(): void { Schema::create('users', function (Blueprint $table) { $table->id(); $table->string('name'); $table->string('email')->unique(); - // $table->timestamp('email_verified_at')->nullable(); $table->string('password'); $table->rememberToken(); $table->timestamps(); }); } - /** - * Reverse the migrations. - * - * @return void - */ - public function down() + public function down(): void { Schema::dropIfExists('users'); } diff --git a/database/migrations/2014_10_12_100000_create_password_resets_table.php b/database/migrations/2014_10_12_100000_create_password_resets_table.php index 0ee0a36..85173b8 100644 --- a/database/migrations/2014_10_12_100000_create_password_resets_table.php +++ b/database/migrations/2014_10_12_100000_create_password_resets_table.php @@ -6,12 +6,7 @@ use Illuminate\Support\Facades\Schema; class CreatePasswordResetsTable extends Migration { - /** - * Run the migrations. - * - * @return void - */ - public function up() + public function up(): void { Schema::create('password_resets', function (Blueprint $table) { $table->string('email')->index(); @@ -20,12 +15,7 @@ class CreatePasswordResetsTable extends Migration }); } - /** - * Reverse the migrations. - * - * @return void - */ - public function down() + public function down(): void { Schema::dropIfExists('password_resets'); } diff --git a/database/migrations/2019_08_19_000000_create_failed_jobs_table.php b/database/migrations/2019_08_19_000000_create_failed_jobs_table.php index 6aa6d74..6304280 100644 --- a/database/migrations/2019_08_19_000000_create_failed_jobs_table.php +++ b/database/migrations/2019_08_19_000000_create_failed_jobs_table.php @@ -6,12 +6,7 @@ use Illuminate\Support\Facades\Schema; class CreateFailedJobsTable extends Migration { - /** - * Run the migrations. - * - * @return void - */ - public function up() + public function up(): void { Schema::create('failed_jobs', function (Blueprint $table) { $table->id(); @@ -24,12 +19,7 @@ class CreateFailedJobsTable extends Migration }); } - /** - * Reverse the migrations. - * - * @return void - */ - public function down() + public function down(): void { Schema::dropIfExists('failed_jobs'); } diff --git a/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php b/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php index 4315e16..fccf466 100644 --- a/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php +++ b/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php @@ -6,12 +6,7 @@ use Illuminate\Support\Facades\Schema; class CreatePersonalAccessTokensTable extends Migration { - /** - * Run the migrations. - * - * @return void - */ - public function up() + public function up(): void { Schema::create('personal_access_tokens', function (Blueprint $table) { $table->id(); @@ -24,12 +19,7 @@ class CreatePersonalAccessTokensTable extends Migration }); } - /** - * Reverse the migrations. - * - * @return void - */ - public function down() + public function down(): void { Schema::dropIfExists('personal_access_tokens'); } diff --git a/database/migrations/2022_02_08_114741_create_categories_table.php b/database/migrations/2022_02_08_114741_create_categories_table.php index 4361e58..b623e0e 100644 --- a/database/migrations/2022_02_08_114741_create_categories_table.php +++ b/database/migrations/2022_02_08_114741_create_categories_table.php @@ -6,12 +6,7 @@ use Illuminate\Support\Facades\Schema; class CreateCategoriesTable extends Migration { - /** - * Run the migrations. - * - * @return void - */ - public function up() + public function up(): void { Schema::create('categories', function (Blueprint $table) { $table->id(); @@ -24,12 +19,7 @@ class CreateCategoriesTable extends Migration }); } - /** - * Reverse the migrations. - * - * @return void - */ - public function down() + public function down(): void { Schema::dropIfExists('categories'); } diff --git a/database/migrations/2022_02_09_075749_create_projects_table.php b/database/migrations/2022_02_09_075749_create_projects_table.php index a577984..e8484fc 100644 --- a/database/migrations/2022_02_09_075749_create_projects_table.php +++ b/database/migrations/2022_02_09_075749_create_projects_table.php @@ -8,13 +8,7 @@ use Illuminate\Support\Facades\Schema; class CreateProjectsTable extends Migration { - - /** - * Run the migrations. - * - * @return void - */ - public function up() + public function up(): void { Schema::create('projects', function (Blueprint $table) { $table->id(); @@ -32,12 +26,7 @@ class CreateProjectsTable extends Migration }); } - /** - * Reverse the migrations. - * - * @return void - */ - public function down() + public function down(): void { Schema::dropIfExists('projects'); } diff --git a/database/seeders/CategorySeeder.php b/database/seeders/CategorySeeder.php index 17babd2..7b4f0d6 100644 --- a/database/seeders/CategorySeeder.php +++ b/database/seeders/CategorySeeder.php @@ -7,12 +7,7 @@ use Illuminate\Database\Seeder; class CategorySeeder extends Seeder { - /** - * Run the database seeds. - * - * @return void - */ - public function run() + public function run(): void { $categories = [ ['name' => 'Wszystkie', 'slug' => 'all', 'default' => true, 'visible' => true], diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index 3d0bbbc..19c8d1e 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -6,14 +6,8 @@ use Illuminate\Database\Seeder; class DatabaseSeeder extends Seeder { - /** - * Seed the application's database. - * - * @return void - */ - public function run() + public function run(): void { - // \App\Models\User::factory(10)->create(); $this->call(CategorySeeder::class); $this->call(UserSeeder::class); } diff --git a/database/seeders/UserSeeder.php b/database/seeders/UserSeeder.php index 249c364..c41da43 100644 --- a/database/seeders/UserSeeder.php +++ b/database/seeders/UserSeeder.php @@ -8,18 +8,8 @@ use Illuminate\Support\Facades\Hash; class UserSeeder extends Seeder { - /** - * Run the database seeds. - * - * @return void - */ - public function run() + public function run(): void { - User::query() - ->create([ - 'name' => 'Kamil Niemczycki', - 'email' => 'admin@admin.pl', - 'password' => Hash::make('password123^') - ]); + User::factory(['email' => 'admin@admin.pl'])->create(); } }