Cachet/app/models/Service.php
Graham Campbell 9d8d89248f CS fixes
2014-12-20 21:20:17 +00:00

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);
}
}