-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathInvitationController.php
More file actions
85 lines (74 loc) · 2.02 KB
/
InvitationController.php
File metadata and controls
85 lines (74 loc) · 2.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
namespace App\Http\Controllers;
use App\Models\Guest;
use Illuminate\Http\Request;
class InvitationController extends Controller
{
/**
* Homepage - Template Selector
*/
public function home()
{
return view('home');
}
/**
* Template 1 - Elegant Modern
*/
public function template1()
{
$data = $this->getInvitationData();
return view('templates.template-1.index', $data);
}
/**
* Template 2 - Classic Romantic
*/
public function template2()
{
$data = $this->getInvitationData();
return view('templates.template-2.index', $data);
}
/**
* Template 3 - Elegant Nature
*/
public function template3()
{
$data = $this->getInvitationData();
return view('templates.template-3.index', $data);
}
/**
* Template 4 - Bugis Emerald
*/
public function template4()
{
$data = $this->getInvitationData();
return view('templates.template-4.index', $data);
}
/**
* Get common invitation data
*/
private function getInvitationData()
{
$eventDate = '2025-12-31 19:00:00';
$confirmedGuests = Guest::where('is_confirmed', true)->count();
$totalCapacity = 200;
// Guest Book data
$wishes = Guest::whereNotNull('message')
->where('message', '!=', '')
->latest()
->paginate(10);
$totalWishes = Guest::whereNotNull('message')->where('message', '!=', '')->count();
$attendingCount = Guest::where('attendance', 'hadir')->count();
$notAttendingCount = Guest::where('attendance', 'tidak_hadir')->count();
$totalGuests = Guest::where('attendance', 'hadir')->sum('number_of_guests');
return compact(
'eventDate',
'confirmedGuests',
'totalCapacity',
'wishes',
'totalWishes',
'attendingCount',
'notAttendingCount',
'totalGuests'
);
}
}