-
-
Notifications
You must be signed in to change notification settings - Fork 80
Expand file tree
/
Copy pathCreateComponent.php
More file actions
28 lines (25 loc) · 764 Bytes
/
CreateComponent.php
File metadata and controls
28 lines (25 loc) · 764 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
namespace Cachet\Actions\Component;
use Cachet\Data\Requests\Component\CreateComponentRequestData;
use Cachet\Enums\ComponentStatusEnum;
use Cachet\Models\Component;
use Cachet\Verbs\Events\Components\ComponentCreated;
class CreateComponent
{
/**
* Handle the action.
*/
public function handle(CreateComponentRequestData $data): Component
{
return ComponentCreated::commit(
name: $data->name,
status: $data->status ?? ComponentStatusEnum::operational,
description: $data->description,
link: $data->link,
order: $data->order ?? 0,
component_group_id: $data->componentGroupId,
enabled: $data->enabled,
meta: [],
);
}
}