fix bulk actions and messages

This commit is contained in:
Jonathan Labreuille
2016-09-06 17:21:15 +02:00
parent f650455a90
commit 4a72995bf4
17 changed files with 207 additions and 175 deletions

View File

@@ -212,7 +212,7 @@ class Segment extends Model {
}
static function bulkTrash($orm) {
return parent::bulkAction($orm, function($ids) {
$count = parent::bulkAction($orm, function($ids) {
parent::rawExecute(join(' ', array(
'UPDATE `'.self::$_table.'`',
'SET `deleted_at` = NOW()',
@@ -220,14 +220,18 @@ class Segment extends Model {
'AND `type` = "default"'
)), $ids);
});
return array('count' => $count);
}
static function bulkDelete($orm) {
return parent::bulkAction($orm, function($ids) {
$count = parent::bulkAction($orm, function($ids) {
// delete segments (only default)
Segment::whereIn('id', $ids)
->where('type', 'default')
->deleteMany();
});
return array('count' => $count);
}
}