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/bekkers/bekkersengineering.nl/app/KommaApp/Kms/Core/KmsController.php
<?php
/**
 *
 *
 * @author      Komma <info@komma.pro>
 * @copyright   (c) 2012-2016, Komma
 */

namespace App\KommaApp\Kms\Core;

use App\KommaApp\Kms\Core\Sections\Section;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Routing\Controller;

class KmsController extends Controller
{
    protected $kms;
    protected $user;

    /** @var Section */
    protected $section;

    /** @var string $forModelName For which model the controller does its job */
    protected $forModelName;

    function __construct(Section $section)
    {
        //Authentication, check if the user is logged in
        $this->middleware('auth:user');
        $this->validateForModel();
        $this->forModelName;
        $this->section = $section;
        $this->kms = \App::make(KmsInterface::class);
    }

    private function validateForModel()
    {
        if(!$this->forModelName) throw new \RuntimeException('Make sure you set (override) the $forModelName property in the controller ('.get_class($this).') to the eloquent model the controller does it\'s job for.');
    }

    /**
     * Returns the section this controller works for
     *
     * @return Section
     */
    public function getSection()
    {
        return $this->section;
    }
}