This commit is contained in:
Meghdad committed 2026-08-24 19:44:24 +03:30
commit 8d5446f466
232 files changed
+25416

No files matched your search

@@ -0,0 +1,33 @@
<?php
namespace Database\Factories;
use App\Models\BazaarApiRequest;
use App\Models\MobileApp;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<BazaarApiRequest>
*/
class BazaarApiRequestFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'mobile_app_id' => MobileApp::factory(),
'operation' => 'purchase.validate',
'method' => 'GET',
'url' => 'https://pardakht.cafebazaar.ir/devapi/v2/api/example',
'status_code' => 200,
'successful' => true,
'duration_ms' => 100,
'request_metadata' => [],
'response_body' => [],
];
}
}
@@ -0,0 +1,32 @@
<?php
namespace Database\Factories;
use App\Models\BazaarPurchase;
use App\Models\MobileApp;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<BazaarPurchase>
*/
class BazaarPurchaseFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'mobile_app_id' => MobileApp::factory(),
'product_id' => fake()->word(),
'purchase_token' => fake()->unique()->uuid(),
'status' => 'purchased',
'is_consumed' => false,
'purchased_at' => now(),
'validated_at' => now(),
'bazaar_response' => [],
];
}
}
@@ -0,0 +1,30 @@
<?php
namespace Database\Factories;
use App\Models\BazaarRelease;
use App\Models\MobileApp;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<BazaarRelease>
*/
class BazaarReleaseFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'mobile_app_id' => MobileApp::factory(),
'status' => 'draft',
'artifact_type' => 'apk',
'staged_rollout_percentage' => 100,
'auto_publish' => false,
'bazaar_response' => [],
];
}
}
@@ -0,0 +1,32 @@
<?php
namespace Database\Factories;
use App\Models\BazaarReview;
use App\Models\MobileApp;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<BazaarReview>
*/
class BazaarReviewFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'mobile_app_id' => MobileApp::factory(),
'bazaar_review_id' => fake()->unique()->numberBetween(1, 99999999),
'user_account_id' => fake()->uuid(),
'rate' => fake()->numberBetween(1, 5),
'text' => fake()->sentence(),
'is_edited' => false,
'published_at' => now(),
'bazaar_response' => [],
];
}
}
@@ -0,0 +1,34 @@
<?php
namespace Database\Factories;
use App\Models\BazaarSubscription;
use App\Models\MobileApp;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<BazaarSubscription>
*/
class BazaarSubscriptionFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'mobile_app_id' => MobileApp::factory(),
'subscription_id' => fake()->word(),
'purchase_token' => fake()->unique()->uuid(),
'linked_subscription_token' => fake()->uuid(),
'status' => 'active',
'auto_renewing' => true,
'starts_at' => now()->subDay(),
'valid_until' => now()->addMonth(),
'validated_at' => now(),
'bazaar_response' => [],
];
}
}
+40
View File
@@ -0,0 +1,40 @@
<?php
namespace Database\Factories;
use App\Models\MobileApp;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
/**
* @extends Factory<MobileApp>
*/
class MobileAppFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'name' => fake()->company(),
'package_name' => 'ir.'.fake()->unique()->domainWord().'.'.fake()->word(),
'client_key' => Str::random(48),
'management_key' => Str::random(64),
'is_active' => true,
'maintenance_mode' => false,
'latest_version_name' => '1.0.0',
'latest_version_code' => 1,
'minimum_version_code' => 1,
'configuration' => [],
'feature_flags' => [],
'bazaar_api_secret' => Str::random(64),
'bazaar_comments_header' => 'CAFEBAZAAR-PISHKHAN-API-SECRET',
'bazaar_comments_secret' => Str::random(64),
'bazaar_sync_enabled' => true,
'bazaar_sync_interval_minutes' => 15,
];
}
}
+45
View File
@@ -0,0 +1,45 @@
<?php
namespace Database\Factories;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;
/**
* @extends Factory<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' => fake()->name(),
'email' => fake()->unique()->safeEmail(),
'email_verified_at' => now(),
'password' => static::$password ??= Hash::make('password'),
'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,
]);
}
}