File: D:/HostingSpaces/fire-tech/fire-tech.nl/app/KommaApp/Clients/Composer/SubscribeComposer.php
<?php
namespace App\KommaApp\Clients\Composer;
use App\KommaApp\Courses\CourseService;
use Illuminate\View\View;
class SubscribeComposer
{
private $courseService;
public function __construct()
{
$this->courseService = new CourseService();
}
/**
* Bind data to the view.
*
* @param View $view
* @return void
*/
public function compose(View $view)
{
$dates = null;
$course = null;
$courseId = null;
if (\Input::has('courseId')) {
$courseId = \Input::get('courseId');
$course = $this->courseService->getCourseById($courseId);
$dates = $this->courseService->getDatesForCourse($courseId);
} elseif(!empty(old('courseId'))) {
$courseId = old('courseId');
$course = $this->courseService->getCourseById($courseId);
$dates = $this->courseService->getDatesForCourse($courseId);
}
$date = null;
if (\Input::has('date')) {
$date = trim(\Input::get('date'));
} elseif(!empty(old('date'))) {
$date = trim(old('date'));
}
$courses = $this->courseService->getAllCourses();
$subscribe_step = null;
if (\Input::has('step')) {
$subscribe_step = \Input::get('step');
} elseif(!empty(old('step'))) {
$subscribe_step = old('step');
}
$view->with([
'subscribe_step' => $subscribe_step,
'courses' => $courses,
'course' => $course,
'dates' => $dates,
'date' => $date]);
}
}