Sending queue router update
- cleaned up useless code - bugfixes - improved code coverage
This commit is contained in:
committed by
Vlad
parent
cfb4265971
commit
409697ee64
@@ -17,36 +17,30 @@ class Form extends Model {
|
||||
function asArray() {
|
||||
$model = parent::asArray();
|
||||
|
||||
$model['body'] = (
|
||||
is_serialized($this->body)
|
||||
$model['body'] = (is_serialized($this->body))
|
||||
? unserialize($this->body)
|
||||
: $this->body
|
||||
);
|
||||
$model['settings'] = (
|
||||
is_serialized($this->settings)
|
||||
: $this->body;
|
||||
$model['settings'] = (is_serialized($this->settings))
|
||||
? unserialize($this->settings)
|
||||
: $this->settings
|
||||
);
|
||||
: $this->settings;
|
||||
|
||||
return $model;
|
||||
}
|
||||
|
||||
function save() {
|
||||
$this->set('body', (
|
||||
is_serialized($this->body)
|
||||
$this->set('body', (is_serialized($this->body))
|
||||
? $this->body
|
||||
: serialize($this->body)
|
||||
));
|
||||
$this->set('settings', (
|
||||
is_serialized($this->settings)
|
||||
);
|
||||
$this->set('settings', (is_serialized($this->settings))
|
||||
? $this->settings
|
||||
: serialize($this->settings)
|
||||
));
|
||||
);
|
||||
return parent::save();
|
||||
}
|
||||
|
||||
static function search($orm, $search = '') {
|
||||
return $orm->where_like('name', '%'.$search.'%');
|
||||
return $orm->whereLike('name', '%'.$search.'%');
|
||||
}
|
||||
|
||||
static function groups() {
|
||||
@@ -67,9 +61,8 @@ class Form extends Model {
|
||||
static function groupBy($orm, $group = null) {
|
||||
if($group === 'trash') {
|
||||
return $orm->whereNotNull('deleted_at');
|
||||
} else {
|
||||
$orm = $orm->whereNull('deleted_at');
|
||||
}
|
||||
return $orm->whereNull('deleted_at');
|
||||
}
|
||||
|
||||
static function createOrUpdate($data = array()) {
|
||||
@@ -87,7 +80,6 @@ class Form extends Model {
|
||||
$form->set($data);
|
||||
}
|
||||
|
||||
$form->save();
|
||||
return $form;
|
||||
return $form->save();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user