create factory and seeder for fake data
This commit is contained in:
@@ -19,6 +19,9 @@ class CountryCallsReportFactory extends Factory
|
||||
{
|
||||
return [
|
||||
'province_id' => Province::factory(),
|
||||
'province_name' => function (array $attributes) {
|
||||
return Province::query()->find($attributes['province_id'])->name;
|
||||
},
|
||||
'date' => $this->faker->date(),
|
||||
'total' => $this->faker->numberBetween(1000, 10000),
|
||||
'route_to_teh4' => $this->faker->numberBetween(10, 100),
|
||||
|
||||
@@ -19,6 +19,9 @@ class CountryKeypressReportFactory extends Factory
|
||||
{
|
||||
return [
|
||||
'province_id' => Province::factory(),
|
||||
'province_name' => function (array $attributes) {
|
||||
return Province::query()->find($attributes['province_id'])->name;
|
||||
},
|
||||
'date' => $this->faker->date(),
|
||||
'total' => $this->faker->numberBetween(1000, 10000),
|
||||
'key1' => $this->faker->numberBetween(10, 100),
|
||||
|
||||
@@ -19,6 +19,9 @@ class CountryMessageRatingReportFactory extends Factory
|
||||
{
|
||||
return [
|
||||
'province_id' => Province::factory(),
|
||||
'province_name' => function (array $attributes) {
|
||||
return Province::query()->find($attributes['province_id'])->name;
|
||||
},
|
||||
'date' => $this->faker->date(),
|
||||
'very_good' => $this->faker->numberBetween(10, 100),
|
||||
'good' => $this->faker->numberBetween(10, 100),
|
||||
|
||||
@@ -19,6 +19,9 @@ class CountryVoiceRatingReportFactory extends Factory
|
||||
{
|
||||
return [
|
||||
'province_id' => Province::factory(),
|
||||
'province_name' => function (array $attributes) {
|
||||
return Province::query()->find($attributes['province_id'])->name;
|
||||
},
|
||||
'date' => $this->faker->date(),
|
||||
'voice_quality_ok' => $this->faker->numberBetween(10, 100),
|
||||
'message_quality_ok' => $this->faker->numberBetween(10, 100),
|
||||
|
||||
@@ -17,9 +17,11 @@ class ProvinceFactory extends Factory
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'name' => $this->faker->state,
|
||||
'name' => $this->faker->name(),
|
||||
'lat' => $this->faker->latitude,
|
||||
'lon' => $this->faker->longitude,
|
||||
'ip' => $this->faker->ipv4,
|
||||
'camera_ip' => $this->faker->ipv4,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ return new class extends Migration
|
||||
Schema::create('country_calls_reports', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('province_id')->constrained('provinces');
|
||||
$table->string('province_name');
|
||||
$table->date('date');
|
||||
$table->integer('total');
|
||||
$table->integer('route_to_teh4');
|
||||
|
||||
@@ -14,6 +14,7 @@ return new class extends Migration
|
||||
Schema::create('country_keypress_reports', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('province_id')->constrained('provinces');
|
||||
$table->string('province_name');
|
||||
$table->date('date');
|
||||
$table->integer('total');
|
||||
$table->integer('key1');
|
||||
|
||||
@@ -14,6 +14,7 @@ return new class extends Migration
|
||||
Schema::create('country_voice_rating_reports', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('province_id')->constrained('provinces');
|
||||
$table->string('province_name');
|
||||
$table->date('date');
|
||||
$table->integer('voice_quality_ok');
|
||||
$table->integer('message_quality_ok');
|
||||
|
||||
@@ -14,6 +14,7 @@ return new class extends Migration
|
||||
Schema::create('country_message_rating_reports', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('province_id')->constrained('provinces');
|
||||
$table->string('province_name');
|
||||
$table->date('date');
|
||||
$table->integer('very_good');
|
||||
$table->integer('good');
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\CountryCallsReport;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
@@ -12,6 +13,6 @@ class CountryCallsReportSeeder extends Seeder
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
//
|
||||
CountryCallsReport::factory()->count(10)->create();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\CountryKeypressReport;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
@@ -12,6 +13,6 @@ class CountryKeypressReportSeeder extends Seeder
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
//
|
||||
CountryKeypressReport::factory()->count(10)->create();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\CountryMessageRatingReport;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
@@ -12,6 +13,6 @@ class CountryMessageRatingReportSeeder extends Seeder
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
//
|
||||
CountryMessageRatingReport::factory()->count(5)->create();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\CountryVoiceRatingReport;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
@@ -12,6 +13,6 @@ class CountryVoiceRatingReportSeeder extends Seeder
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
//
|
||||
CountryVoiceRatingReport::factory()->count(10)->create();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user