File: D:/HostingSpaces/SBogers10/stafa.komma.pro/app/Komma/Shop/Discounts/DiscountController.php
<?php
namespace App\Komma\Shop\Discounts;
/**
* @author Komma <info@komma.pro>
* @copyright (c) 2012-2016, Komma
*/
use App\Komma\Kms\Core\SectionController;
class DiscountController extends SectionController
{
protected $slug = "discounts";
protected $forModelName = Discount::class;
/**
* Constructor
* @param DiscountSection $section
*/
public function __construct(DiscountSection $section)
{
parent::__construct($section);
$this->treeService->setSectionService($this->section->getSectionService());
$this->treeService->setForModelName(new Discount());
}
public function getPageStructureAsJson($siteSlug)
{
$this->siteService->setCurrentSiteBySlug($siteSlug);
$tree = $this->treeService->getStructure();
return \Response::json($tree);
}
public function setPageStructureAsJson($siteSlug)
{
$this->siteService->setCurrentSiteBySlug($siteSlug);
// Special way to get POST data send by ajax on IIS servers
$data = json_decode(\Request::instance()->getContent());
$tree = json_decode($data->tree);
$tree = $this->treeService->setStructure($tree);
return \Response::json($tree);
}
}