public function index_onDelete() { if (($checkedIds = post('checked')) && is_array($checkedIds) && count($checkedIds)) { foreach ($checkedIds as $channelId) { if (!($channel = Channel::find($channelId))) { continue; } $channel->delete(); } Flash::success('Successfully deleted those channels.'); } return $this->listRefresh(); }
public function reorder_onMove() { $sourceNode = Channel::find(post('sourceNode')); $targetNode = post('targetNode') ? Channel::find(post('targetNode')) : null; if ($sourceNode == $targetNode) { return; } switch (post('position')) { case 'before': $sourceNode->moveBefore($targetNode); break; case 'after': $sourceNode->moveAfter($targetNode); break; case 'child': $sourceNode->makeChildOf($targetNode); break; default: $sourceNode->makeRoot(); break; } // $this->vars['records'] = Channel::make()->getEagerRoot(); // return ['#reorderRecords' => $this->makePartial('reorder_records')]; }
public function onMove() { $member = $this->getMember(); if (!$member->is_moderator) { Flash::error('Access denied'); return; } $channelId = post('channel'); $channel = ChannelModel::find($channelId); if ($channel) { $this->getTopic()->moveToChannel($channel); Flash::success(post('flash', 'Post moved successfully!')); } else { Flash::error('Unable to find a channel to move to.'); } }