Use event image if present

This commit is contained in:
Yoann Lecuyer 2016-06-19 11:52:45 -05:00
parent 5365b1172e
commit dca10200f4
3 changed files with 14 additions and 3 deletions

View File

@ -49,9 +49,15 @@ class MyBaseController extends Controller
{
$event = Event::scope()->findOrFail($event_id);
$image_path = $event->organiser->full_logo_path;
if ($event->images->first() != null) {
$image_path = $event->images()->first()->image_path;
}
return array_merge([
'event' => $event,
'questions' => $event->questions()->get(),
'image_path' => $image_path,
], $additional_data);
}

View File

@ -60,12 +60,17 @@ class GenerateTicket extends Job implements ShouldQueue
}
$attendees = $query->get();
$image_path = $event->organiser->full_logo_path;
if ($event->images->first() != null) {
$image_path = $event->images()->first()->image_path;
}
$data = [
'order' => $order,
'event' => $event,
'attendees' => $attendees,
'css' => file_get_contents(public_path('assets/stylesheet/ticket.css')),
'image' => base64_encode(file_get_contents(public_path($event->organiser->full_logo_path))),
'image' => base64_encode(file_get_contents(public_path($image_path))),
];
PDF::setOutputMode('F'); // force to file

View File

@ -15,7 +15,7 @@
</style>
<div class="ticket">
<div class="logo">
{!! HTML::image(asset($event->organiser->full_logo_path)) !!}
{!! HTML::image(asset($image_path)) !!}
</div>
<div class="event_details">
@ -39,4 +39,4 @@
<div class="barcode">
{!! DNS2D::getBarcodeSVG('hello', "QRCODE", 6, 6) !!}
</div>
</div>
</div>