HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/rentman2019.komma.pro/app/Komma/Kms/Core/SiteSectionController.php
<?php

///**
// *
// *
// * @author      Komma <info@komma.pro>
// * @copyright   (c) 2012-2016, Komma
// */
//
//namespace App\Komma\Kms\Core;
//
//use App\Komma\Kms\Core\Sections\Section;
//
//class SiteSectionController extends KmsController
//{
//    /** @var Section $section */
//    protected $section;
//
//    protected $slug = null;
//
//    /**
//     * This method is called on the overview page.
//     * It will render the section and view.
//     *
//     * @param $siteSlug string
//     * @return mixed
//     */
//    public function index($siteSlug)
//    {
//        $this->kms->setSite($siteSlug);
//
//        //Load models for sidebar
//        $this->section->loadModels();
//
//        //Disable the right pane
//        $this->section->showEntity = false;
//        //Render the page
//        $this->section->setForModelName($this->forModelName);
//
//        return $this->section->render();
//    }
//
//    /**
//     * This method is called when a item is selected.
//     * By default it will generate an edit form.
//     *
//     * @param $siteSlug
//     * @param $id | Model id
//     * @return mixed
//     */
//    public function show($siteSlug, $id)
//    {
//        $this->kms->setSite($siteSlug);
//
//        //Load models for sidebar
//        $this->section->loadModels();
//
//        return $this->edit($siteSlug, $id);
//    }
//
//    /**
//     * This method is called when we want to edit an item.
//     * It is called from the $this->show method.
//     *
//     * @param $siteSlug
//     * @param $id | Model id
//     * @return mixed
//     * @internal param $site | Site name
//     */
//    public function edit($siteSlug, $id = null)
//    {
//        $this->kms->setSite($siteSlug);
//
//        //Load models for sidebar
//        $this->section->loadModels();
//
//        // Get input
//        if( ! $id) $id = \Route::current()->getParameter(str_replace('-', '_', $this->slug));
//
//        // Build section tabs
//        $this->section->getSectionTabDirector()->buildTabs();
//
//        //Load the model
//        $this->section->loadModel($id);
//
//        $this->section->setForModelName($this->forModelName);
//        $view = $this->section->render();
//
////        $this->section->setErrors(\Session::get('errors'));
//
//        return $view;
//    }
//
//    /**
//     * This method will generate a new item form
//     *
//     * @return mixed
//     */
//    public function create($siteSlug)
//    {
//        $this->kms->setSite($siteSlug);
//
//        //Load models for sidebar
//        $this->section->loadModels();
//
//        // Build section tabs
//        $this->section->getSectionTabDirector()->buildTabs();
//
//        // Create new model
//        $this->section->setOrCreateModel(null);
//
//        //Set errors
////        $this->section->setErrors(\Session::get('errors'));
//
//        //Render the form
//        $this->section->setForModelName($this->forModelName);
//
//        return $this->section->render();
//    }
//
//    /**
//     * This method will validate and save the model
//     * It is called on create form submit,
//     * and it is called on the form edit.
//     *
//     * @param $siteSlug
//     * @param null $model
//     * @return mixed
//     * @throws \Exception
//     * @internal param null $id
//     */
//    public function store($siteSlug, $model = null)
//    {
//        $this->kms->setSite($siteSlug);
//
//        $model = $this->section->setOrCreateModel($model);
//        $this->section->generateAttributesAndAddThemToTabs();
//
//        //Validate the form data
//        $validator = $this->section->validateInputAndReturnValidator();
//
//        //Check if the validator fails
//        if($validator->fails())
//        {
//
//            //It fails, redirect back with errors
//            return \Redirect::back()->withInput()->withErrors($validator->messages());
//
//        }
//
//        $id = $this->section->save($model);
//
//        return \Redirect::action('\\' . get_class($this) . '@show', [
//            'site'      => $this->kms->getSiteSlug(),
//            $this->slug => $id
//        ])
//            ->with('success', __('kms/global.saved'))
//            ->with('current_tab', \Input::get('tab-slug')); // Pass the opened tab
//    }
//
//
//    /**
//     * This method handles the update functionality.
//     * And is called by the edit form.
//     *
//     * @param $site | Site name
//     * @param $id | Model id
//     * @return mixed
//     * @throws \Exception
//     */
//    public function update($siteSlug, $id)
//    {
//        $this->kms->setSite($siteSlug);
//
//        //Get the id from the uri
//        if( ! $id) $id = \Route::current()->getParameter(str_replace('-', '_', $this->slug));
//
//        //Handle the rest in the store method
//        return $this->store($siteSlug, $id);
//    }
//
//    /**
//     * This method is called when a item will be deleted
//     *
//     * @param $siteSlug
//     * @param $id | Model id
//     * @return mixed
//     */
//    public function destroy($siteSlug, $id)
//    {
//        $this->kms->setSite($siteSlug);
//
//        // Get input
//        if( ! $id) $id = \Route::current()->getParameter(str_replace('-', '_', $this->slug));
//
//        // Action
//        $this->section->destroy($id);
//
//        // Create output
//        return \Redirect::action('\\' . get_class($this) . '@index', ['siteSlug' => $this->kms->getSiteSlug()])
//            ->with('message', __('kms/global.removed'));
//    }
//}