File: D:/HostingSpaces/netwerkbrabant/netwerkbrabant.nl/app/KommaApp/Questions/QuestionController.php
<?php
namespace App\KommaApp\Questions;
use App\Http\Controllers\Controller;
use App\KommaApp\Questions\Kms\QuestionService;
use App\KommaApp\Questions\Models\Question;
use Illuminate\Http\JsonResponse;
class QuestionController extends Controller
{
private $modelPrefix = 'pages.questions';
private $questionService;
public function __construct(QuestionService $questionService)
{
parent::__construct();
$this->questionService = $questionService;
}
/**
* @param Question $question
* @return \Illuminate\Contracts\View\View
*/
public function index()
{
$questions = Question::with('translations')
->where('active', '=', 1)
->orderBy('lft')
->get();
$page = $this->pageService->getPageById(request()->attributes->get('page_id'));
$page->translation = $this->decodeDynamicContent($page->translation);
// Return view
return \View::make($this->baseViewPath.$this->modelPrefix.'.index',[
'questions' => $questions,
'page' => $page
]);
}
}