File: D:/HostingSpaces/zipwire/zipwire.nl/app/KommaApp/Shop/Orders/Kms/OrderController.php
<?php
namespace App\KommaApp\Shop\Orders\Kms;
/**
* @author Komma <info@komma.pro>
* @copyright (c) 2012-2016, Komma
*/
use App\KommaApp\Kms\Core\Kms;
use App\KommaApp\Kms\Core\SectionController;
use App\KommaApp\Kms\Core\SiteSectionController;
use App\KommaApp\Kms\Core\Tree\TreeService;
use App\KommaApp\Shop\Orders\Models\Order;
class OrderController extends SectionController
{
protected $slug = "orders";
protected $forModelName = Order::class;
protected $treeService;
/**
* Constructor
* @param Kms $kms
* @param OrderSection $section
* @param TreeService $treeService
*/
public function __construct(OrderSection $section, TreeService $treeService)
{
parent::__construct($section);
$this->treeService = $treeService;
$this->treeService->setSectionService($this->section->getSectionService());
$this->treeService->setModel(new Order());
}
public function getOrderStructureAsJson()
// public function getOrderStructureAsJson($siteSlug)
{
// $this->kms->setSite($siteSlug);
$tree = $this->treeService->getStructure();
return \Response::json($tree);
}
// public function setOrderStructureAsJson($siteSlug)
public function setOrderStructureAsJson()
{
// $this->kms->setSite($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->setStructureWithJson($tree);
return \Response::json($tree);
}
}