#feature: add config page
This commit is contained in:
23
database/factories/IpUserMappingFactory.php
Normal file
23
database/factories/IpUserMappingFactory.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\IpUserMapping;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<IpUserMapping>
|
||||
*/
|
||||
class IpUserMappingFactory extends Factory
|
||||
{
|
||||
protected $model = IpUserMapping::class;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'ip_address' => $this->faker->unique()->ipv4(),
|
||||
'user_name' => $this->faker->userName(),
|
||||
'remark' => $this->faker->optional()->sentence(6),
|
||||
];
|
||||
}
|
||||
}
|
||||
35
database/factories/OperationLogFactory.php
Normal file
35
database/factories/OperationLogFactory.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\OperationLog;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<OperationLog>
|
||||
*/
|
||||
class OperationLogFactory extends Factory
|
||||
{
|
||||
protected $model = OperationLog::class;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
$payload = $this->faker->optional()->randomElement([
|
||||
['action' => 'create', 'status' => 'ok'],
|
||||
['item_id' => 1, 'count' => 2],
|
||||
['note' => 'sample'],
|
||||
]);
|
||||
|
||||
return [
|
||||
'ip_address' => $this->faker->ipv4(),
|
||||
'user_label' => $this->faker->optional()->userName(),
|
||||
'method' => $this->faker->randomElement(['POST', 'PUT', 'PATCH', 'DELETE']),
|
||||
'path' => '/' . $this->faker->slug(2),
|
||||
'route_name' => $this->faker->optional()->slug(2),
|
||||
'status_code' => $this->faker->randomElement([200, 201, 204, 400, 403, 422, 500]),
|
||||
'duration_ms' => $this->faker->numberBetween(1, 5000),
|
||||
'request_payload' => $payload,
|
||||
'user_agent' => $this->faker->userAgent(),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user