File: D:/HostingSpaces/fire-tech/fire-tech.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;
}
}