mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-20 06:24:44 +02:00

* feat: First Webhook PoC draft * feat: Dispatch Webhooks PoC * fix: typo in webhook configuration scope * Update 2024_04_21_162552_create_webhooks_table.php Co-authored-by: Lance Pioch <lancepioch@gmail.com> * Update 2024_04_21_162552_create_webhooks_table.php Co-authored-by: Lance Pioch <lancepioch@gmail.com> * Update 2024_04_21_162544_create_webhook_configurations_table.php Co-authored-by: Lance Pioch <lancepioch@gmail.com> * Update 2024_04_21_162544_create_webhook_configurations_table.php Co-authored-by: Lance Pioch <lancepioch@gmail.com> * Update DispatchWebhooks.php Co-authored-by: Lance Pioch <lancepioch@gmail.com> * Update DispatchWebhooksJob.php Co-authored-by: Lance Pioch <lancepioch@gmail.com> * Update DispatchWebhookForConfiguration.php Co-authored-by: Lance Pioch <lancepioch@gmail.com> * Update DispatchWebhookForConfiguration.php Co-authored-by: Lance Pioch <lancepioch@gmail.com> * Update DispatchWebhookForConfiguration.php Co-authored-by: Lance Pioch <lancepioch@gmail.com> * Update DispatchWebhooksJob.php Co-authored-by: Lance Pioch <lancepioch@gmail.com> * Update DispatchWebhooksJob.php Co-authored-by: Lance Pioch <lancepioch@gmail.com> * Update DispatchWebhooksJob.php Co-authored-by: Lance Pioch <lancepioch@gmail.com> * chore: Implement Webhook Event Discovery * we got a test working for webhooks * WIP * Something is working! * More tests * clean up the tests now that they are passing * WIP * Don't use model specific events * WIP * WIP * WIP * WIP * WIP * Do it sync * Reset these * Don't need restored event type * Deleted some unused jobs * Find custom Events * Remove observers * Add custom event test * Run Pint * Add caching * Don't cache every single event * Fix tests * Run Pint * Phpstan fixes * Pint fix * Test fixes * Middleware unit test fix * Pint fixes * Remove index not working for older dbs * Use facade instead --------- Co-authored-by: Pascale Beier <mail@pascalebeier.de> Co-authored-by: Lance Pioch <lancepioch@gmail.com> Co-authored-by: Vehikl <go@vehikl.com>
69 lines
1.8 KiB
PHP
69 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\Allocation;
|
|
use App\Models\Egg;
|
|
use App\Models\Node;
|
|
use App\Models\User;
|
|
use Carbon\Carbon;
|
|
use Ramsey\Uuid\Uuid;
|
|
use Illuminate\Support\Str;
|
|
use App\Models\Server;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
class ServerFactory extends Factory
|
|
{
|
|
/**
|
|
* The name of the factory's corresponding model.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $model = Server::class;
|
|
|
|
public function withNode(?Node $node = null): static
|
|
{
|
|
$node ??= Node::factory()->create();
|
|
|
|
return $this->state(fn () => [
|
|
'node_id' => $node->id,
|
|
'allocation_id' => Allocation::factory([
|
|
'node_id' => $node->id,
|
|
]),
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* Define the model's default state.
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'owner_id' => User::factory(),
|
|
'node_id' => Node::factory(),
|
|
'allocation_id' => Allocation::factory(),
|
|
'egg_id' => Egg::factory(),
|
|
'uuid' => Uuid::uuid4()->toString(),
|
|
'uuid_short' => Str::lower(Str::random(8)),
|
|
'name' => $this->faker->firstName(),
|
|
'description' => implode(' ', $this->faker->sentences()),
|
|
'skip_scripts' => 0,
|
|
'status' => null,
|
|
'memory' => 512,
|
|
'swap' => 0,
|
|
'disk' => 512,
|
|
'io' => 500,
|
|
'cpu' => 0,
|
|
'threads' => null,
|
|
'oom_killer' => false,
|
|
'startup' => '/bin/bash echo "hello world"',
|
|
'image' => 'foo/bar:latest',
|
|
'allocation_limit' => null,
|
|
'database_limit' => null,
|
|
'backup_limit' => 0,
|
|
'created_at' => Carbon::now(),
|
|
'updated_at' => Carbon::now(),
|
|
];
|
|
}
|
|
}
|