2016-03-05 00:18:10 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Http\Controllers;
|
2016-02-29 15:59:36 +00:00
|
|
|
|
|
|
|
|
use App\Models\Event;
|
2016-03-05 00:18:10 +00:00
|
|
|
|
2016-02-29 15:59:36 +00:00
|
|
|
use App\Models\Organiser;
|
|
|
|
|
use View;
|
|
|
|
|
|
2016-03-05 00:18:10 +00:00
|
|
|
class MyBaseController extends Controller
|
|
|
|
|
{
|
2016-02-29 15:59:36 +00:00
|
|
|
public function __construct()
|
|
|
|
|
{
|
|
|
|
|
View::share('organisers', Organiser::scope()->get());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Setup the layout used by the controller.
|
|
|
|
|
*
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
2016-03-05 00:18:10 +00:00
|
|
|
protected function setupLayout()
|
|
|
|
|
{
|
2016-02-29 15:59:36 +00:00
|
|
|
if (!is_null($this->layout)) {
|
|
|
|
|
$this->layout = View::make($this->layout);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns data which is required in each view, optionally combined with additional data.
|
2016-03-05 00:18:10 +00:00
|
|
|
*
|
|
|
|
|
* @param int $event_id
|
2016-02-29 15:59:36 +00:00
|
|
|
* @param array $additional_data
|
2016-03-05 00:18:10 +00:00
|
|
|
*
|
2016-02-29 15:59:36 +00:00
|
|
|
* @return arrau
|
|
|
|
|
*/
|
2016-03-05 00:18:10 +00:00
|
|
|
public function getEventViewData($event_id, $additional_data = [])
|
|
|
|
|
{
|
|
|
|
|
return array_merge([
|
|
|
|
|
'event' => Event::scope()->findOrFail($event_id),
|
|
|
|
|
], $additional_data);
|
2016-02-29 15:59:36 +00:00
|
|
|
}
|
|
|
|
|
}
|