Initial commit
This commit is contained in:
28
database/factories/BandFactory.php
Normal file
28
database/factories/BandFactory.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Band;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Band>
|
||||
*/
|
||||
class BandFactory extends Factory
|
||||
{
|
||||
protected $model = Band::class;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
$start = $this->faker->numberBetween(100000000, 1000000000);
|
||||
$end = $start + $this->faker->numberBetween(1000000, 10000000);
|
||||
|
||||
return [
|
||||
'name' => $this->faker->randomElement(['144 MHz', '432 MHz', '1.3 GHz']),
|
||||
'order' => $this->faker->numberBetween(1, 10),
|
||||
'edi_band_begin' => $start,
|
||||
'edi_band_end' => $end,
|
||||
'has_power_category' => $this->faker->boolean(),
|
||||
];
|
||||
}
|
||||
}
|
||||
22
database/factories/CategoryFactory.php
Normal file
22
database/factories/CategoryFactory.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Category;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Category>
|
||||
*/
|
||||
class CategoryFactory extends Factory
|
||||
{
|
||||
protected $model = Category::class;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'name' => strtoupper($this->faker->bothify('CAT-??')),
|
||||
'order' => $this->faker->numberBetween(1, 20),
|
||||
];
|
||||
}
|
||||
}
|
||||
33
database/factories/ContestFactory.php
Normal file
33
database/factories/ContestFactory.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Contest;
|
||||
use App\Models\EvaluationRuleSet;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Contest>
|
||||
*/
|
||||
class ContestFactory extends Factory
|
||||
{
|
||||
protected $model = Contest::class;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
$title = $this->faker->words(2, true);
|
||||
|
||||
return [
|
||||
'name' => [
|
||||
'cs' => $title,
|
||||
'en' => $title,
|
||||
],
|
||||
'description' => [
|
||||
'cs' => $this->faker->sentence(),
|
||||
'en' => $this->faker->sentence(),
|
||||
],
|
||||
'rule_set_id' => EvaluationRuleSet::factory(),
|
||||
'is_active' => true,
|
||||
];
|
||||
}
|
||||
}
|
||||
34
database/factories/ContestParameterFactory.php
Normal file
34
database/factories/ContestParameterFactory.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Contest;
|
||||
use App\Models\ContestParameter;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\ContestParameter>
|
||||
*/
|
||||
class ContestParameterFactory extends Factory
|
||||
{
|
||||
protected $model = ContestParameter::class;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'contest_id' => Contest::factory(),
|
||||
'log_type' => $this->faker->randomElement(['STANDARD', 'CHECK']),
|
||||
'ignore_slash_part' => true,
|
||||
'ignore_third_part' => true,
|
||||
'letters_in_rst' => true,
|
||||
'discard_qso_rec_diff_call' => true,
|
||||
'discard_qso_sent_diff_call' => false,
|
||||
'discard_qso_rec_diff_rst' => true,
|
||||
'discard_qso_sent_diff_rst' => false,
|
||||
'discard_qso_rec_diff_code' => true,
|
||||
'discard_qso_sent_diff_code' => false,
|
||||
'unique_qso' => true,
|
||||
'time_tolerance' => 600,
|
||||
];
|
||||
}
|
||||
}
|
||||
22
database/factories/CountryWwlFactory.php
Normal file
22
database/factories/CountryWwlFactory.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\CountryWwl;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\CountryWwl>
|
||||
*/
|
||||
class CountryWwlFactory extends Factory
|
||||
{
|
||||
protected $model = CountryWwl::class;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'country_name' => $this->faker->unique()->country(),
|
||||
'wwl' => strtoupper($this->faker->bothify('??##')),
|
||||
];
|
||||
}
|
||||
}
|
||||
34
database/factories/CtyFactory.php
Normal file
34
database/factories/CtyFactory.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Cty;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Cty>
|
||||
*/
|
||||
class CtyFactory extends Factory
|
||||
{
|
||||
protected $model = Cty::class;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
$prefix = strtoupper($this->faker->unique()->bothify('T??'));
|
||||
|
||||
return [
|
||||
'country_name' => $this->faker->country(),
|
||||
'dxcc' => $this->faker->numberBetween(1, 400),
|
||||
'cq_zone' => $this->faker->numberBetween(1, 40),
|
||||
'itu_zone' => $this->faker->numberBetween(1, 90),
|
||||
'continent' => $this->faker->randomElement(['EU', 'AS', 'AF', 'NA', 'SA', 'OC', 'AN']),
|
||||
'latitude' => $this->faker->latitude(),
|
||||
'longitude' => $this->faker->longitude(),
|
||||
'time_offset' => $this->faker->randomFloat(2, -12, 12),
|
||||
'prefix' => $prefix,
|
||||
'prefix_norm' => $prefix,
|
||||
'precise' => $this->faker->boolean(),
|
||||
'source' => 'test',
|
||||
];
|
||||
}
|
||||
}
|
||||
21
database/factories/EdiBandFactory.php
Normal file
21
database/factories/EdiBandFactory.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\EdiBand;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\EdiBand>
|
||||
*/
|
||||
class EdiBandFactory extends Factory
|
||||
{
|
||||
protected $model = EdiBand::class;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'value' => $this->faker->unique()->bothify('BAND-##'),
|
||||
];
|
||||
}
|
||||
}
|
||||
21
database/factories/EdiCategoryFactory.php
Normal file
21
database/factories/EdiCategoryFactory.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\EdiCategory;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\EdiCategory>
|
||||
*/
|
||||
class EdiCategoryFactory extends Factory
|
||||
{
|
||||
protected $model = EdiCategory::class;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'value' => $this->faker->unique()->bothify('CAT-##'),
|
||||
];
|
||||
}
|
||||
}
|
||||
23
database/factories/EvaluationRuleSetFactory.php
Normal file
23
database/factories/EvaluationRuleSetFactory.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\EvaluationRuleSet;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\EvaluationRuleSet>
|
||||
*/
|
||||
class EvaluationRuleSetFactory extends Factory
|
||||
{
|
||||
protected $model = EvaluationRuleSet::class;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'name' => $this->faker->words(2, true),
|
||||
'code' => strtoupper($this->faker->unique()->bothify('RULE_##??')),
|
||||
'description' => $this->faker->sentence(),
|
||||
];
|
||||
}
|
||||
}
|
||||
28
database/factories/EvaluationRunFactory.php
Normal file
28
database/factories/EvaluationRunFactory.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\EvaluationRun;
|
||||
use App\Models\EvaluationRuleSet;
|
||||
use App\Models\Round;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\EvaluationRun>
|
||||
*/
|
||||
class EvaluationRunFactory extends Factory
|
||||
{
|
||||
protected $model = EvaluationRun::class;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'round_id' => Round::factory(),
|
||||
'rule_set_id' => EvaluationRuleSet::factory(),
|
||||
'name' => $this->faker->words(2, true),
|
||||
'rules_version' => 'OFFICIAL',
|
||||
'is_official' => false,
|
||||
'notes' => null,
|
||||
];
|
||||
}
|
||||
}
|
||||
29
database/factories/FileFactory.php
Normal file
29
database/factories/FileFactory.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\File;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\File>
|
||||
*/
|
||||
class FileFactory extends Factory
|
||||
{
|
||||
protected $model = File::class;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
$filename = $this->faker->lexify('log-????.edi');
|
||||
|
||||
return [
|
||||
'path' => 'uploads/test/' . $filename,
|
||||
'filename' => $filename,
|
||||
'mimetype' => 'text/plain',
|
||||
'filesize' => 10,
|
||||
'hash' => Str::random(64),
|
||||
'uploaded_by' => null,
|
||||
];
|
||||
}
|
||||
}
|
||||
27
database/factories/LogFactory.php
Normal file
27
database/factories/LogFactory.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Log;
|
||||
use App\Models\Round;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Log>
|
||||
*/
|
||||
class LogFactory extends Factory
|
||||
{
|
||||
protected $model = Log::class;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'round_id' => Round::factory(),
|
||||
'pcall' => strtoupper($this->faker->bothify('OK#???')),
|
||||
'pwwlo' => $this->faker->randomElement(['JN79', 'JN89', 'JO60', 'JN99']),
|
||||
'psect' => $this->faker->randomElement(['A', 'B', 'C', 'D']),
|
||||
'pband' => $this->faker->randomElement(['144', '432', '1296']),
|
||||
'power_watt' => $this->faker->numberBetween(10, 1000),
|
||||
];
|
||||
}
|
||||
}
|
||||
26
database/factories/LogOverrideFactory.php
Normal file
26
database/factories/LogOverrideFactory.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\EvaluationRun;
|
||||
use App\Models\Log;
|
||||
use App\Models\LogOverride;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\LogOverride>
|
||||
*/
|
||||
class LogOverrideFactory extends Factory
|
||||
{
|
||||
protected $model = LogOverride::class;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'evaluation_run_id' => EvaluationRun::factory(),
|
||||
'log_id' => Log::factory(),
|
||||
'forced_log_status' => 'AUTO',
|
||||
'reason' => $this->faker->sentence(),
|
||||
];
|
||||
}
|
||||
}
|
||||
30
database/factories/LogQsoFactory.php
Normal file
30
database/factories/LogQsoFactory.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Log;
|
||||
use App\Models\LogQso;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\LogQso>
|
||||
*/
|
||||
class LogQsoFactory extends Factory
|
||||
{
|
||||
protected $model = LogQso::class;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'log_id' => Log::factory(),
|
||||
'qso_index' => $this->faker->numberBetween(1, 1000),
|
||||
'time_on' => $this->faker->dateTime(),
|
||||
'band' => $this->faker->randomElement(['144', '432', '1296']),
|
||||
'freq_khz' => $this->faker->numberBetween(144000, 1296000),
|
||||
'mode' => $this->faker->randomElement(['CW', 'SSB', 'FM']),
|
||||
'my_call' => strtoupper($this->faker->bothify('OK#???')),
|
||||
'dx_call' => strtoupper($this->faker->bothify('DL#???')),
|
||||
'points' => $this->faker->numberBetween(1, 500),
|
||||
];
|
||||
}
|
||||
}
|
||||
29
database/factories/LogResultFactory.php
Normal file
29
database/factories/LogResultFactory.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\EvaluationRun;
|
||||
use App\Models\Log;
|
||||
use App\Models\LogResult;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\LogResult>
|
||||
*/
|
||||
class LogResultFactory extends Factory
|
||||
{
|
||||
protected $model = LogResult::class;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'evaluation_run_id' => EvaluationRun::factory(),
|
||||
'log_id' => Log::factory(),
|
||||
'claimed_qso_count' => $this->faker->numberBetween(10, 200),
|
||||
'claimed_score' => $this->faker->numberBetween(100, 5000),
|
||||
'valid_qso_count' => $this->faker->numberBetween(10, 200),
|
||||
'official_score' => $this->faker->numberBetween(100, 5000),
|
||||
'status' => 'OK',
|
||||
];
|
||||
}
|
||||
}
|
||||
46
database/factories/NewsPostFactory.php
Normal file
46
database/factories/NewsPostFactory.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\NewsPost;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\NewsPost>
|
||||
*/
|
||||
class NewsPostFactory extends Factory
|
||||
{
|
||||
protected $model = NewsPost::class;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
$title = $this->faker->sentence(4);
|
||||
|
||||
return [
|
||||
'title' => [
|
||||
'cs' => $title,
|
||||
'en' => $title,
|
||||
],
|
||||
'slug' => Str::slug($title) . '-' . $this->faker->unique()->numberBetween(100, 999),
|
||||
'content' => [
|
||||
'cs' => $this->faker->paragraph(),
|
||||
'en' => $this->faker->paragraph(),
|
||||
],
|
||||
'excerpt' => [
|
||||
'cs' => $this->faker->sentence(),
|
||||
'en' => $this->faker->sentence(),
|
||||
],
|
||||
'is_published' => true,
|
||||
'published_at' => now()->subDay(),
|
||||
];
|
||||
}
|
||||
|
||||
public function unpublished(): static
|
||||
{
|
||||
return $this->state(fn () => [
|
||||
'is_published' => false,
|
||||
'published_at' => null,
|
||||
]);
|
||||
}
|
||||
}
|
||||
23
database/factories/PowerCategoryFactory.php
Normal file
23
database/factories/PowerCategoryFactory.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\PowerCategory;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\PowerCategory>
|
||||
*/
|
||||
class PowerCategoryFactory extends Factory
|
||||
{
|
||||
protected $model = PowerCategory::class;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'name' => strtoupper($this->faker->unique()->bothify('PWR-?')),
|
||||
'order' => $this->faker->numberBetween(1, 10),
|
||||
'power_level' => $this->faker->numberBetween(10, 1000),
|
||||
];
|
||||
}
|
||||
}
|
||||
26
database/factories/QsoOverrideFactory.php
Normal file
26
database/factories/QsoOverrideFactory.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\EvaluationRun;
|
||||
use App\Models\LogQso;
|
||||
use App\Models\QsoOverride;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\QsoOverride>
|
||||
*/
|
||||
class QsoOverrideFactory extends Factory
|
||||
{
|
||||
protected $model = QsoOverride::class;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'evaluation_run_id' => EvaluationRun::factory(),
|
||||
'log_qso_id' => LogQso::factory(),
|
||||
'forced_status' => 'AUTO',
|
||||
'reason' => $this->faker->sentence(),
|
||||
];
|
||||
}
|
||||
}
|
||||
27
database/factories/QsoResultFactory.php
Normal file
27
database/factories/QsoResultFactory.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\EvaluationRun;
|
||||
use App\Models\LogQso;
|
||||
use App\Models\QsoResult;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\QsoResult>
|
||||
*/
|
||||
class QsoResultFactory extends Factory
|
||||
{
|
||||
protected $model = QsoResult::class;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'evaluation_run_id' => EvaluationRun::factory(),
|
||||
'log_qso_id' => LogQso::factory(),
|
||||
'is_valid' => true,
|
||||
'is_operating_window_excluded' => false,
|
||||
'points' => $this->faker->numberBetween(1, 500),
|
||||
];
|
||||
}
|
||||
}
|
||||
41
database/factories/RoundFactory.php
Normal file
41
database/factories/RoundFactory.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Contest;
|
||||
use App\Models\EvaluationRuleSet;
|
||||
use App\Models\Round;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Round>
|
||||
*/
|
||||
class RoundFactory extends Factory
|
||||
{
|
||||
protected $model = Round::class;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
$title = $this->faker->words(3, true);
|
||||
$start = now()->startOfDay()->addHours(14);
|
||||
$end = (clone $start)->addHours(2);
|
||||
$deadline = (clone $end)->addDays(2);
|
||||
|
||||
return [
|
||||
'contest_id' => Contest::factory(),
|
||||
'rule_set_id' => EvaluationRuleSet::factory(),
|
||||
'name' => [
|
||||
'cs' => $title,
|
||||
'en' => $title,
|
||||
],
|
||||
'description' => [
|
||||
'cs' => $this->faker->sentence(),
|
||||
'en' => $this->faker->sentence(),
|
||||
],
|
||||
'start_time' => $start,
|
||||
'end_time' => $end,
|
||||
'logs_deadline' => $deadline,
|
||||
'is_active' => true,
|
||||
];
|
||||
}
|
||||
}
|
||||
58
database/factories/UserFactory.php
Normal file
58
database/factories/UserFactory.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User>
|
||||
*/
|
||||
class UserFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The current password being used by the factory.
|
||||
*/
|
||||
protected static ?string $password;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'name' => $this->faker->name(),
|
||||
'email' => $this->faker->unique()->safeEmail(),
|
||||
'email_verified_at' => now(),
|
||||
'password' => static::$password ??= Hash::make('demodemo'),
|
||||
'remember_token' => Str::random(10),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate that the model's email address should be unverified.
|
||||
*/
|
||||
public function unverified(): static
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'email_verified_at' => null,
|
||||
]);
|
||||
}
|
||||
|
||||
public function admin(): static
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'is_admin' => true,
|
||||
]);
|
||||
}
|
||||
|
||||
public function inactive(): static
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'is_active' => false,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user