mirror of
https://github.com/CachetHQ/Cachet.git
synced 2025-02-24 03:34:12 +01:00
34 lines
759 B
PHP
34 lines
759 B
PHP
<?php
|
|
|
|
use Watson\Validating\ValidatingTrait;
|
|
|
|
class Service extends Eloquent
|
|
{
|
|
use ValidatingTrait;
|
|
|
|
protected $rules = [
|
|
'type' => 'alpha_dash|required',
|
|
'active' => 'required|in:0,1',
|
|
'properties' => '',
|
|
];
|
|
|
|
/**
|
|
* Returns a decoded properties object for the service.
|
|
* @param string $properties
|
|
* @return object
|
|
*/
|
|
public function getPropertiesAttribute($properties)
|
|
{
|
|
return json_decode($properties);
|
|
}
|
|
|
|
/**
|
|
* Sets the properties attribute which auto encodes to a JSON string.
|
|
* @param mixed $properties
|
|
*/
|
|
public function setPropertiesAttribute($properties)
|
|
{
|
|
$this->attributes['properties'] = json_encode($properties);
|
|
}
|
|
}
|