Rename Bus Add to Create
This commit is contained in:
118
app/Bus/Commands/Component/CreateComponentCommand.php
Normal file
118
app/Bus/Commands/Component/CreateComponentCommand.php
Normal file
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Cachet.
|
||||
*
|
||||
* (c) Alt Three Services Limited
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace CachetHQ\Cachet\Bus\Commands\Component;
|
||||
|
||||
/**
|
||||
* This is the create component command class.
|
||||
*
|
||||
* @author James Brooks <james@alt-three.com>
|
||||
*/
|
||||
final class CreateComponentCommand
|
||||
{
|
||||
/**
|
||||
* The component name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* The component description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $description;
|
||||
|
||||
/**
|
||||
* The component status.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $status;
|
||||
|
||||
/**
|
||||
* The component link.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $link;
|
||||
|
||||
/**
|
||||
* The component order.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $order;
|
||||
|
||||
/**
|
||||
* The component group.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $group_id;
|
||||
|
||||
/**
|
||||
* Is the component enabled?
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $enabled;
|
||||
|
||||
/**
|
||||
* JSON meta data for the component.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $meta;
|
||||
|
||||
/**
|
||||
* The validation rules.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
public $rules = [
|
||||
'name' => 'required|string',
|
||||
'description' => 'required|string',
|
||||
'status' => 'required|int|min:0|max:4',
|
||||
'link' => 'nullable|url',
|
||||
'order' => 'nullable|int',
|
||||
'group_id' => 'nullable|int',
|
||||
'enabled' => 'nullable|bool',
|
||||
'meta' => 'nullable|string',
|
||||
];
|
||||
|
||||
/**
|
||||
* Create a new add component command instance.
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $description
|
||||
* @param int $status
|
||||
* @param string $link
|
||||
* @param int $order
|
||||
* @param int $group_id
|
||||
* @param bool $enabled
|
||||
* @param string|null $meta
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($name, $description, $status, $link, $order, $group_id, $enabled, $meta)
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->description = $description;
|
||||
$this->status = (int) $status;
|
||||
$this->link = $link;
|
||||
$this->order = $order;
|
||||
$this->group_id = $group_id;
|
||||
$this->enabled = $enabled;
|
||||
$this->meta = $meta;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user