File: D:/HostingSpaces/SBogers10/zelfverkopen.komma.pro/app/KommaApp/Vacancies/Kms/VacancyController.php
<?php
namespace App\KommaApp\Vacancies\Kms;
/**
* @author Komma <info@komma.pro>
* @copyright (c) 2012-2016, Komma
*/
use App\KommaApp\Kms\Core\SectionController;
use App\KommaApp\Kms\Core\Tree\TreeService;
use App\KommaApp\Vacancies\Models\Vacancy;
class VacancyController extends SectionController
{
protected $slug = "vacancies";
protected $forModelName = Vacancy::class;
protected $treeService;
function __construct(VacancySection $section, TreeService $treeService)
{
parent::__construct($section);
$this->treeService = $treeService;
$this->treeService->setSectionService($this->section->getSectionService());
$this->treeService->setModel(new Vacancy());
}
public function getPageStructureAsJson()
{
$tree = $this->treeService->getStructure();
return \Response::json($tree);
}
public function setPageStructureAsJson()
{
// 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);
}
}