Compare commits
183 Commits
beads-sync
...
53a90fec33
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
53a90fec33 | ||
|
|
e1a2850768 | ||
|
|
03ee16bb87 | ||
|
|
1313135020 | ||
|
|
85f2c42fc5 | ||
|
|
6318aec3cb | ||
|
|
056d864f80 | ||
|
|
ef88342bd0 | ||
|
|
d76b26b7ad | ||
|
|
c1dfbaa51e | ||
|
|
32644eb41e | ||
|
|
db5fea9f2a | ||
|
|
fba9714ede | ||
|
|
cebc1d1ec5 | ||
|
|
5aa79b587d | ||
|
|
2e089f7f77 | ||
|
|
fd52f8e13d | ||
|
|
8ac38cf264 | ||
|
|
66193a6461 | ||
|
|
64c9d7357a | ||
|
|
8aa2efdd9a | ||
|
|
4f3503e3f4 | ||
|
|
4235eda49a | ||
|
|
ad0e8b7923 | ||
|
|
446eb15c6b | ||
|
|
02a24877f7 | ||
|
|
f016004b2b | ||
|
|
a0248d976b | ||
|
|
99a880854a | ||
|
|
a3747138a4 | ||
|
|
287cc8a532 | ||
|
|
191f39cf5b | ||
|
|
543b3015ca | ||
|
|
9d3c866562 | ||
|
|
911880f1a0 | ||
|
|
b9d91c8f40 | ||
|
|
23193a3452 | ||
|
|
da6f95aead | ||
|
|
2f9a700e00 | ||
|
|
50cc4e76df | ||
|
|
941931934f | ||
|
|
9b245e9c51 | ||
|
|
b9708d5174 | ||
|
|
a038594130 | ||
|
|
9bab5f6c89 | ||
|
|
ebab856137 | ||
|
|
fa33e7cbcf | ||
|
|
198fbf6751 | ||
|
|
246e54f970 | ||
|
|
1c5412e82c | ||
|
|
0b1430e64d | ||
|
|
52c2aa0e9b | ||
|
|
dd459aa381 | ||
|
|
02ec14a0d3 | ||
|
|
e490f9995c | ||
|
|
5e5b69f655 | ||
|
|
e5e74febbd | ||
|
|
5674ed99f1 | ||
|
|
6ab24e65a1 | ||
|
|
d7ba1880dc | ||
|
|
9d8f01d294 | ||
|
|
f88aa40315 | ||
|
|
cb5d5a2870 | ||
|
|
e28eb9a90b | ||
|
|
3c2ebdbc0e | ||
|
|
a916bf8c4d | ||
|
|
7a71efedd1 | ||
|
|
e1221e0466 | ||
|
|
508c8201fa | ||
|
|
750acb0bec | ||
|
|
42f6178b6d | ||
|
|
802e360c8e | ||
|
|
7030e8b5b9 | ||
|
|
b61507ea04 | ||
|
|
dfaf21898a | ||
|
|
fbd48afbd6 | ||
|
|
6f6d8901ec | ||
|
|
d4ab9a3a20 | ||
|
|
fbff2afa3e | ||
|
|
926bc7d070 | ||
|
|
f1f552ad2d | ||
|
|
4219daba25 | ||
|
|
1e821a2fb4 | ||
|
|
48d4716ab1 | ||
|
|
45f0cea264 | ||
|
|
9d7990fe71 | ||
|
|
0c5939e541 | ||
|
|
e7e095cec9 | ||
|
|
d905ba8e6c | ||
|
|
40bed1e44e | ||
|
|
7e77dd2931 | ||
|
|
b316beb522 | ||
|
|
6d3f4f36e8 | ||
|
|
9e4ea3dafb | ||
|
|
1517eb8631 | ||
|
|
9a4ece33bf | ||
|
|
30c653913d | ||
|
|
4c37f874bd | ||
|
|
05fdda811b | ||
|
|
eeeca0eed5 | ||
|
|
fa6a5678f0 | ||
|
|
63956087a4 | ||
|
|
a3f153de6f | ||
|
|
8d729c6a86 | ||
|
|
7ad43a3661 | ||
|
|
7aa0a4c847 | ||
|
|
df60be826d | ||
|
|
918bff08aa | ||
|
|
292c8f0b26 | ||
|
|
11018f273d | ||
|
|
7e32d8f706 | ||
|
|
ad829ae509 | ||
|
|
2f93271d94 | ||
|
|
62255dc9e7 | ||
|
|
738659112d | ||
|
|
89d9b656de | ||
|
|
5d0ae0faa5 | ||
|
|
2ecd417b55 | ||
|
|
3755213010 | ||
|
|
9cb236f123 | ||
|
|
10232cf40e | ||
|
|
3ce6507268 | ||
|
|
a39295a0f0 | ||
|
|
5dc69fb187 | ||
|
|
92b341bdcd | ||
|
|
725a7a29b3 | ||
|
|
8634d16359 | ||
|
|
81446b37c3 | ||
|
|
33e46b448d | ||
|
|
289ef70e53 | ||
|
|
d0559bf8c9 | ||
|
|
0ef4b32bf6 | ||
|
|
3612c97e86 | ||
|
|
c0510581c6 | ||
|
|
1ffd3e3b9d | ||
|
|
e05ee3b186 | ||
|
|
cf7b2e563a | ||
|
|
719afb6920 | ||
|
|
83c58358a1 | ||
|
|
2b888078a0 | ||
|
|
2f584162d6 | ||
|
|
0833ea6b36 | ||
|
|
5bdc15d399 | ||
|
|
693540f609 | ||
|
|
c0193c9581 | ||
|
|
03c7b20cae | ||
|
|
3a78c4f2c0 | ||
|
|
fa333deed9 | ||
|
|
a733df6221 | ||
|
|
5ee1baa7e2 | ||
|
|
2f19752199 | ||
|
|
7dd7ec14a4 | ||
|
|
d9568be579 | ||
|
|
9cf6e9d94d | ||
|
|
a23ce0c86f | ||
|
|
9efea136bd | ||
|
|
7a6f489b8b | ||
|
|
cc11e024f0 | ||
|
|
2089251a92 | ||
|
|
53094b8d36 | ||
|
|
0c33c1ddc1 | ||
|
|
ce0b7c951a | ||
|
|
fbbbbdac4c | ||
|
|
94d0713ec0 | ||
|
|
3e36354916 | ||
|
|
24a1319cc2 | ||
|
|
b1250c6246 | ||
|
|
fd7a3c846a | ||
|
|
1ca7545f86 | ||
|
|
9f4a202d2b | ||
|
|
fe0525e678 | ||
|
|
d62efdb55c | ||
|
|
be722f6e37 | ||
|
|
898ac9ff0e | ||
|
|
c8d1ac7971 | ||
|
|
3ee23f3a66 | ||
|
|
993c351832 | ||
|
|
2444a62a4d | ||
|
|
e52720a3cb | ||
|
|
93bed358ba | ||
|
|
a16bd9c498 | ||
|
|
e32b1fa45a | ||
|
|
6edc890e01 |
6
.beads/.gitignore
vendored
6
.beads/.gitignore
vendored
@@ -11,6 +11,12 @@ daemon.log
|
|||||||
daemon.pid
|
daemon.pid
|
||||||
bd.sock
|
bd.sock
|
||||||
sync-state.json
|
sync-state.json
|
||||||
|
.sync.lock
|
||||||
|
last-touched
|
||||||
|
sync_base.jsonl
|
||||||
|
.sync.lock
|
||||||
|
last-touched
|
||||||
|
sync_base.jsonl
|
||||||
|
|
||||||
# Local version tracking (prevents upgrade notification spam after git ops)
|
# Local version tracking (prevents upgrade notification spam after git ops)
|
||||||
.local_version
|
.local_version
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
# This setting persists across clones (unlike database config which is gitignored).
|
# This setting persists across clones (unlike database config which is gitignored).
|
||||||
# Can also use BEADS_SYNC_BRANCH env var for local override.
|
# Can also use BEADS_SYNC_BRANCH env var for local override.
|
||||||
# If not set, bd sync will require you to run 'bd config set sync.branch <branch>'.
|
# If not set, bd sync will require you to run 'bd config set sync.branch <branch>'.
|
||||||
# sync-branch: "beads-sync"
|
sync-branch: "beads-sync"
|
||||||
|
|
||||||
# Multi-repo configuration (experimental - bd-307)
|
# Multi-repo configuration (experimental - bd-307)
|
||||||
# Allows hydrating from multiple repositories and routing writes to the correct JSONL
|
# Allows hydrating from multiple repositories and routing writes to the correct JSONL
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
{"id":"fotospiel-app-38f","title":"Paddle catalog sync: surface last sync error/log context in admin","status":"closed","priority":2,"issue_type":"task","created_at":"2026-01-01T15:59:14.865414785+01:00","created_by":"soeren","updated_at":"2026-01-02T21:16:09.109922491+01:00","closed_at":"2026-01-02T21:16:09.109922491+01:00","close_reason":"Completed"}
|
{"id":"fotospiel-app-38f","title":"Paddle catalog sync: surface last sync error/log context in admin","status":"closed","priority":2,"issue_type":"task","created_at":"2026-01-01T15:59:14.865414785+01:00","created_by":"soeren","updated_at":"2026-01-02T21:16:09.109922491+01:00","closed_at":"2026-01-02T21:16:09.109922491+01:00","close_reason":"Completed"}
|
||||||
{"id":"fotospiel-app-3ut","title":"SEC-API-03 Synthetic monitoring + alert config","status":"open","priority":2,"issue_type":"task","created_at":"2026-01-01T15:52:46.793875724+01:00","created_by":"soeren","updated_at":"2026-01-01T15:52:46.793875724+01:00"}
|
{"id":"fotospiel-app-3ut","title":"SEC-API-03 Synthetic monitoring + alert config","status":"open","priority":2,"issue_type":"task","created_at":"2026-01-01T15:52:46.793875724+01:00","created_by":"soeren","updated_at":"2026-01-01T15:52:46.793875724+01:00"}
|
||||||
{"id":"fotospiel-app-3xa","title":"Security review: event admin code audit (policies, PKCE, file handling)","status":"open","priority":2,"issue_type":"task","created_at":"2026-01-01T16:05:20.115675149+01:00","created_by":"soeren","updated_at":"2026-01-01T16:05:20.115675149+01:00"}
|
{"id":"fotospiel-app-3xa","title":"Security review: event admin code audit (policies, PKCE, file handling)","status":"open","priority":2,"issue_type":"task","created_at":"2026-01-01T16:05:20.115675149+01:00","created_by":"soeren","updated_at":"2026-01-01T16:05:20.115675149+01:00"}
|
||||||
{"id":"fotospiel-app-43mp","title":"Help-System für Event Admin PWA planen","notes":"Context help links wired into priority admin pages.","status":"in_progress","priority":2,"issue_type":"task","owner":"codex-agent@example.com","created_at":"2026-01-23T08:21:47.812129626+01:00","created_by":"Codex Agent","updated_at":"2026-01-23T09:19:45.828239299+01:00"}
|
{"id":"fotospiel-app-43mp","title":"Help-System für Event Admin PWA planen","status":"open","priority":2,"issue_type":"task","owner":"codex-agent@example.com","created_at":"2026-01-23T08:21:47.812129626+01:00","created_by":"Codex Agent","updated_at":"2026-01-23T08:21:47.812129626+01:00"}
|
||||||
{"id":"fotospiel-app-4ar","title":"SEC-BILL-03 Failed capture notifications + ledger hook","status":"open","priority":2,"issue_type":"task","created_at":"2026-01-01T15:54:33.266516715+01:00","created_by":"soeren","updated_at":"2026-01-01T15:54:33.266516715+01:00"}
|
{"id":"fotospiel-app-4ar","title":"SEC-BILL-03 Failed capture notifications + ledger hook","status":"open","priority":2,"issue_type":"task","created_at":"2026-01-01T15:54:33.266516715+01:00","created_by":"soeren","updated_at":"2026-01-01T15:54:33.266516715+01:00"}
|
||||||
{"id":"fotospiel-app-4en","title":"Add translations for Mobile Package Shop","description":"The new MobilePackageShopPage.tsx uses translation keys like 'shop.title', 'shop.legal.agb', etc. Ensure these are added to the management.json files for de and en.","status":"closed","priority":2,"issue_type":"task","created_at":"2026-01-06T18:05:50.469751088+01:00","created_by":"soeren","updated_at":"2026-01-06T18:14:19.984343737+01:00","closed_at":"2026-01-06T18:14:19.984346372+01:00"}
|
{"id":"fotospiel-app-4en","title":"Add translations for Mobile Package Shop","description":"The new MobilePackageShopPage.tsx uses translation keys like 'shop.title', 'shop.legal.agb', etc. Ensure these are added to the management.json files for de and en.","status":"closed","priority":2,"issue_type":"task","created_at":"2026-01-06T18:05:50.469751088+01:00","created_by":"soeren","updated_at":"2026-01-06T18:14:19.984343737+01:00","closed_at":"2026-01-06T18:14:19.984346372+01:00"}
|
||||||
{"id":"fotospiel-app-4i4","title":"Security review: map roles/data","status":"closed","priority":2,"issue_type":"task","created_at":"2026-01-01T16:02:58.370301875+01:00","created_by":"soeren","updated_at":"2026-01-01T16:03:03.997327414+01:00","closed_at":"2026-01-01T16:03:03.997327414+01:00","close_reason":"Completed in codebase (verified)"}
|
{"id":"fotospiel-app-4i4","title":"Security review: map roles/data","status":"closed","priority":2,"issue_type":"task","created_at":"2026-01-01T16:02:58.370301875+01:00","created_by":"soeren","updated_at":"2026-01-01T16:03:03.997327414+01:00","closed_at":"2026-01-01T16:03:03.997327414+01:00","close_reason":"Completed in codebase (verified)"}
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
fotospiel-app-29r
|
fotospiel-app-43mp
|
||||||
|
|||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -12,6 +12,7 @@ fotospiel-tenant-app
|
|||||||
/resources/js/wayfinder
|
/resources/js/wayfinder
|
||||||
/storage/*.key
|
/storage/*.key
|
||||||
/storage/pail
|
/storage/pail
|
||||||
|
/C:\\wwwroot\\fotospiel-app\\storage\\app/
|
||||||
/vendor
|
/vendor
|
||||||
/clients/photobooth-uploader/**/bin
|
/clients/photobooth-uploader/**/bin
|
||||||
/clients/photobooth-uploader/**/obj
|
/clients/photobooth-uploader/**/obj
|
||||||
|
|||||||
@@ -337,8 +337,8 @@ Tokens are design system values that can be referenced using the `$` prefix.
|
|||||||
|
|
||||||
### Color Tokens
|
### Color Tokens
|
||||||
|
|
||||||
- `accent`: #FFB6C1
|
- `accent`: #3D5AFE
|
||||||
- `accentSoft`: #FFE5EC
|
- `accentSoft`: #E8ECFF
|
||||||
- `blue10Dark`: hsl(209, 100%, 60.6%)
|
- `blue10Dark`: hsl(209, 100%, 60.6%)
|
||||||
- `blue10Light`: hsl(208, 100%, 47.3%)
|
- `blue10Light`: hsl(208, 100%, 47.3%)
|
||||||
- `blue11Dark`: hsl(210, 100%, 66.1%)
|
- `blue11Dark`: hsl(210, 100%, 66.1%)
|
||||||
@@ -363,8 +363,8 @@ Tokens are design system values that can be referenced using the `$` prefix.
|
|||||||
- `blue8Light`: hsl(206, 81.9%, 65.3%)
|
- `blue8Light`: hsl(206, 81.9%, 65.3%)
|
||||||
- `blue9Dark`: hsl(206, 100%, 50.0%)
|
- `blue9Dark`: hsl(206, 100%, 50.0%)
|
||||||
- `blue9Light`: hsl(206, 100%, 50.0%)
|
- `blue9Light`: hsl(206, 100%, 50.0%)
|
||||||
- `border`: #F2E4DA
|
- `border`: #F3D6C9
|
||||||
- `danger`: #E04848
|
- `danger`: #EF4444
|
||||||
- `gray10Dark`: hsl(0, 0%, 49.4%)
|
- `gray10Dark`: hsl(0, 0%, 49.4%)
|
||||||
- `gray10Light`: hsl(0, 0%, 52.3%)
|
- `gray10Light`: hsl(0, 0%, 52.3%)
|
||||||
- `gray11Dark`: hsl(0, 0%, 62.8%)
|
- `gray11Dark`: hsl(0, 0%, 62.8%)
|
||||||
@@ -413,7 +413,7 @@ Tokens are design system values that can be referenced using the `$` prefix.
|
|||||||
- `green8Light`: hsl(151, 40.2%, 54.1%)
|
- `green8Light`: hsl(151, 40.2%, 54.1%)
|
||||||
- `green9Dark`: hsl(151, 55.0%, 41.5%)
|
- `green9Dark`: hsl(151, 55.0%, 41.5%)
|
||||||
- `green9Light`: hsl(151, 55.0%, 41.5%)
|
- `green9Light`: hsl(151, 55.0%, 41.5%)
|
||||||
- `muted`: #F4ECE8
|
- `muted`: #FFF6F0
|
||||||
- `orange10Dark`: hsl(24, 100%, 58.5%)
|
- `orange10Dark`: hsl(24, 100%, 58.5%)
|
||||||
- `orange10Light`: hsl(24, 100%, 46.5%)
|
- `orange10Light`: hsl(24, 100%, 46.5%)
|
||||||
- `orange11Dark`: hsl(24, 100%, 62.2%)
|
- `orange11Dark`: hsl(24, 100%, 62.2%)
|
||||||
@@ -462,7 +462,7 @@ Tokens are design system values that can be referenced using the `$` prefix.
|
|||||||
- `pink8Light`: hsl(323, 60.3%, 72.4%)
|
- `pink8Light`: hsl(323, 60.3%, 72.4%)
|
||||||
- `pink9Dark`: hsl(322, 65.0%, 54.5%)
|
- `pink9Dark`: hsl(322, 65.0%, 54.5%)
|
||||||
- `pink9Light`: hsl(322, 65.0%, 54.5%)
|
- `pink9Light`: hsl(322, 65.0%, 54.5%)
|
||||||
- `primary`: #FF5A5F
|
- `primary`: #FF5C5C
|
||||||
- `purple10Dark`: hsl(273, 57.3%, 59.1%)
|
- `purple10Dark`: hsl(273, 57.3%, 59.1%)
|
||||||
- `purple10Light`: hsl(272, 46.8%, 50.3%)
|
- `purple10Light`: hsl(272, 46.8%, 50.3%)
|
||||||
- `purple11Dark`: hsl(275, 80.0%, 71.0%)
|
- `purple11Dark`: hsl(275, 80.0%, 71.0%)
|
||||||
@@ -511,10 +511,10 @@ Tokens are design system values that can be referenced using the `$` prefix.
|
|||||||
- `red8Light`: hsl(359, 69.5%, 74.3%)
|
- `red8Light`: hsl(359, 69.5%, 74.3%)
|
||||||
- `red9Dark`: hsl(358, 75.0%, 59.0%)
|
- `red9Dark`: hsl(358, 75.0%, 59.0%)
|
||||||
- `red9Light`: hsl(358, 75.0%, 59.0%)
|
- `red9Light`: hsl(358, 75.0%, 59.0%)
|
||||||
- `success`: #06D6A0
|
- `success`: #22C55E
|
||||||
- `surface`: #ffffff
|
- `surface`: #ffffff
|
||||||
- `text`: #1F2937
|
- `text`: #0B132B
|
||||||
- `warning`: #F5C542
|
- `warning`: #FBBF24
|
||||||
- `yellow10Dark`: hsl(54, 100%, 68.0%)
|
- `yellow10Dark`: hsl(54, 100%, 68.0%)
|
||||||
- `yellow10Light`: hsl(50, 100%, 48.5%)
|
- `yellow10Light`: hsl(50, 100%, 48.5%)
|
||||||
- `yellow11Dark`: hsl(48, 100%, 47.0%)
|
- `yellow11Dark`: hsl(48, 100%, 47.0%)
|
||||||
|
|||||||
@@ -5152,7 +5152,7 @@ var require_useMergeRefs = __commonJS({
|
|||||||
}
|
}
|
||||||
return React83.useMemo(
|
return React83.useMemo(
|
||||||
() => (0, _mergeRefs.default)(...args),
|
() => (0, _mergeRefs.default)(...args),
|
||||||
// eslint-disable-next-line
|
|
||||||
[...args]
|
[...args]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -12243,7 +12243,7 @@ var require_useMergeRefs2 = __commonJS({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
[...refs]
|
[...refs]
|
||||||
// eslint-disable-line react-hooks/exhaustive-deps
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
__name(useMergeRefs, "useMergeRefs");
|
__name(useMergeRefs, "useMergeRefs");
|
||||||
@@ -12938,7 +12938,7 @@ var require_VirtualizedSectionList = __commonJS({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
this._renderItem = (listItemCount) => (
|
this._renderItem = (listItemCount) => (
|
||||||
// eslint-disable-next-line react/no-unstable-nested-components
|
|
||||||
(_ref2) => {
|
(_ref2) => {
|
||||||
var item = _ref2.item, index5 = _ref2.index;
|
var item = _ref2.item, index5 = _ref2.index;
|
||||||
var info = this._subExtractor(index5);
|
var info = this._subExtractor(index5);
|
||||||
@@ -30935,17 +30935,17 @@ function useInteractions(propsList) {
|
|||||||
const itemDeps = propsList.map((key) => key == null ? void 0 : key.item);
|
const itemDeps = propsList.map((key) => key == null ? void 0 : key.item);
|
||||||
const getReferenceProps = React51.useCallback(
|
const getReferenceProps = React51.useCallback(
|
||||||
(userProps) => mergeProps(userProps, propsList, "reference"),
|
(userProps) => mergeProps(userProps, propsList, "reference"),
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
referenceDeps
|
referenceDeps
|
||||||
);
|
);
|
||||||
const getFloatingProps = React51.useCallback(
|
const getFloatingProps = React51.useCallback(
|
||||||
(userProps) => mergeProps(userProps, propsList, "floating"),
|
(userProps) => mergeProps(userProps, propsList, "floating"),
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
floatingDeps
|
floatingDeps
|
||||||
);
|
);
|
||||||
const getItemProps = React51.useCallback(
|
const getItemProps = React51.useCallback(
|
||||||
(userProps) => mergeProps(userProps, propsList, "item"),
|
(userProps) => mergeProps(userProps, propsList, "item"),
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
itemDeps
|
itemDeps
|
||||||
);
|
);
|
||||||
return React51.useMemo(() => ({
|
return React51.useMemo(() => ({
|
||||||
@@ -33866,7 +33866,7 @@ function FloatingFocusManager(props) {
|
|||||||
queueMicrotask(() => {
|
queueMicrotask(() => {
|
||||||
const tabbableReturnElement = getFirstTabbableElement(returnElement);
|
const tabbableReturnElement = getFirstTabbableElement(returnElement);
|
||||||
if (
|
if (
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
returnFocusRef.current && !preventReturnFocusRef.current && isHTMLElement(tabbableReturnElement) && // If the focus moved somewhere else after mount, avoid returning focus
|
returnFocusRef.current && !preventReturnFocusRef.current && isHTMLElement(tabbableReturnElement) && // If the focus moved somewhere else after mount, avoid returning focus
|
||||||
// since it likely entered a different element which should be
|
// since it likely entered a different element which should be
|
||||||
// respected: https://github.com/floating-ui/floating-ui/issues/2607
|
// respected: https://github.com/floating-ui/floating-ui/issues/2607
|
||||||
@@ -34615,17 +34615,17 @@ function useInteractions2(propsList) {
|
|||||||
const itemDeps = propsList.map((key) => key == null ? void 0 : key.item);
|
const itemDeps = propsList.map((key) => key == null ? void 0 : key.item);
|
||||||
const getReferenceProps = React60.useCallback(
|
const getReferenceProps = React60.useCallback(
|
||||||
(userProps) => mergeProps2(userProps, propsList, "reference"),
|
(userProps) => mergeProps2(userProps, propsList, "reference"),
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
referenceDeps
|
referenceDeps
|
||||||
);
|
);
|
||||||
const getFloatingProps = React60.useCallback(
|
const getFloatingProps = React60.useCallback(
|
||||||
(userProps) => mergeProps2(userProps, propsList, "floating"),
|
(userProps) => mergeProps2(userProps, propsList, "floating"),
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
floatingDeps
|
floatingDeps
|
||||||
);
|
);
|
||||||
const getItemProps = React60.useCallback(
|
const getItemProps = React60.useCallback(
|
||||||
(userProps) => mergeProps2(userProps, propsList, "item"),
|
(userProps) => mergeProps2(userProps, propsList, "item"),
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
itemDeps
|
itemDeps
|
||||||
);
|
);
|
||||||
return React60.useMemo(() => ({
|
return React60.useMemo(() => ({
|
||||||
@@ -39482,17 +39482,17 @@ function useInteractions3(propsList) {
|
|||||||
const itemDeps = propsList.map((key) => key == null ? void 0 : key.item);
|
const itemDeps = propsList.map((key) => key == null ? void 0 : key.item);
|
||||||
const getReferenceProps = React76.useCallback(
|
const getReferenceProps = React76.useCallback(
|
||||||
(userProps) => mergeProps3(userProps, propsList, "reference"),
|
(userProps) => mergeProps3(userProps, propsList, "reference"),
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
referenceDeps
|
referenceDeps
|
||||||
);
|
);
|
||||||
const getFloatingProps = React76.useCallback(
|
const getFloatingProps = React76.useCallback(
|
||||||
(userProps) => mergeProps3(userProps, propsList, "floating"),
|
(userProps) => mergeProps3(userProps, propsList, "floating"),
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
floatingDeps
|
floatingDeps
|
||||||
);
|
);
|
||||||
const getItemProps = React76.useCallback(
|
const getItemProps = React76.useCallback(
|
||||||
(userProps) => mergeProps3(userProps, propsList, "item"),
|
(userProps) => mergeProps3(userProps, propsList, "item"),
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
itemDeps
|
itemDeps
|
||||||
);
|
);
|
||||||
return React76.useMemo(() => ({
|
return React76.useMemo(() => ({
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
854642
.tamagui/tamagui.config.json
854642
.tamagui/tamagui.config.json
File diff suppressed because it is too large
Load Diff
@@ -118,319 +118,8 @@ var isWindowDefined = typeof window < "u";
|
|||||||
var isClient = isWeb && isWindowDefined;
|
var isClient = isWeb && isWindowDefined;
|
||||||
var isChrome = typeof navigator < "u" && /Chrome/.test(navigator.userAgent || "");
|
var isChrome = typeof navigator < "u" && /Chrome/.test(navigator.userAgent || "");
|
||||||
var isWebTouchable = isClient && ("ontouchstart" in window || navigator.maxTouchPoints > 0);
|
var isWebTouchable = isClient && ("ontouchstart" in window || navigator.maxTouchPoints > 0);
|
||||||
var isAndroid = false;
|
|
||||||
var isIos = process.env.TEST_NATIVE_PLATFORM === "ios";
|
var isIos = process.env.TEST_NATIVE_PLATFORM === "ios";
|
||||||
|
|
||||||
// node_modules/@tamagui/helpers/dist/esm/validStyleProps.mjs
|
|
||||||
var textColors = {
|
|
||||||
color: true,
|
|
||||||
textDecorationColor: true,
|
|
||||||
textShadowColor: true
|
|
||||||
};
|
|
||||||
var tokenCategories = {
|
|
||||||
radius: {
|
|
||||||
borderRadius: true,
|
|
||||||
borderTopLeftRadius: true,
|
|
||||||
borderTopRightRadius: true,
|
|
||||||
borderBottomLeftRadius: true,
|
|
||||||
borderBottomRightRadius: true,
|
|
||||||
// logical
|
|
||||||
borderStartStartRadius: true,
|
|
||||||
borderStartEndRadius: true,
|
|
||||||
borderEndStartRadius: true,
|
|
||||||
borderEndEndRadius: true
|
|
||||||
},
|
|
||||||
size: {
|
|
||||||
width: true,
|
|
||||||
height: true,
|
|
||||||
minWidth: true,
|
|
||||||
minHeight: true,
|
|
||||||
maxWidth: true,
|
|
||||||
maxHeight: true,
|
|
||||||
blockSize: true,
|
|
||||||
minBlockSize: true,
|
|
||||||
maxBlockSize: true,
|
|
||||||
inlineSize: true,
|
|
||||||
minInlineSize: true,
|
|
||||||
maxInlineSize: true
|
|
||||||
},
|
|
||||||
zIndex: {
|
|
||||||
zIndex: true
|
|
||||||
},
|
|
||||||
color: {
|
|
||||||
backgroundColor: true,
|
|
||||||
borderColor: true,
|
|
||||||
borderBlockStartColor: true,
|
|
||||||
borderBlockEndColor: true,
|
|
||||||
borderBlockColor: true,
|
|
||||||
borderBottomColor: true,
|
|
||||||
borderInlineColor: true,
|
|
||||||
borderInlineStartColor: true,
|
|
||||||
borderInlineEndColor: true,
|
|
||||||
borderTopColor: true,
|
|
||||||
borderLeftColor: true,
|
|
||||||
borderRightColor: true,
|
|
||||||
borderEndColor: true,
|
|
||||||
borderStartColor: true,
|
|
||||||
shadowColor: true,
|
|
||||||
...textColors,
|
|
||||||
outlineColor: true,
|
|
||||||
caretColor: true
|
|
||||||
}
|
|
||||||
};
|
|
||||||
var stylePropsUnitless = {
|
|
||||||
WebkitLineClamp: true,
|
|
||||||
animationIterationCount: true,
|
|
||||||
aspectRatio: true,
|
|
||||||
borderImageOutset: true,
|
|
||||||
borderImageSlice: true,
|
|
||||||
borderImageWidth: true,
|
|
||||||
columnCount: true,
|
|
||||||
flex: true,
|
|
||||||
flexGrow: true,
|
|
||||||
flexOrder: true,
|
|
||||||
flexPositive: true,
|
|
||||||
flexShrink: true,
|
|
||||||
flexNegative: true,
|
|
||||||
fontWeight: true,
|
|
||||||
gridRow: true,
|
|
||||||
gridRowEnd: true,
|
|
||||||
gridRowGap: true,
|
|
||||||
gridRowStart: true,
|
|
||||||
gridColumn: true,
|
|
||||||
gridColumnEnd: true,
|
|
||||||
gridColumnGap: true,
|
|
||||||
gridColumnStart: true,
|
|
||||||
gridTemplateColumns: true,
|
|
||||||
gridTemplateAreas: true,
|
|
||||||
lineClamp: true,
|
|
||||||
opacity: true,
|
|
||||||
order: true,
|
|
||||||
orphans: true,
|
|
||||||
tabSize: true,
|
|
||||||
widows: true,
|
|
||||||
zIndex: true,
|
|
||||||
zoom: true,
|
|
||||||
scale: true,
|
|
||||||
scaleX: true,
|
|
||||||
scaleY: true,
|
|
||||||
scaleZ: true,
|
|
||||||
shadowOpacity: true
|
|
||||||
};
|
|
||||||
var stylePropsTransform = {
|
|
||||||
x: true,
|
|
||||||
y: true,
|
|
||||||
scale: true,
|
|
||||||
perspective: true,
|
|
||||||
scaleX: true,
|
|
||||||
scaleY: true,
|
|
||||||
skewX: true,
|
|
||||||
skewY: true,
|
|
||||||
matrix: true,
|
|
||||||
rotate: true,
|
|
||||||
rotateY: true,
|
|
||||||
rotateX: true,
|
|
||||||
rotateZ: true
|
|
||||||
};
|
|
||||||
var stylePropsView = {
|
|
||||||
backfaceVisibility: true,
|
|
||||||
borderBottomEndRadius: true,
|
|
||||||
borderBottomStartRadius: true,
|
|
||||||
borderBottomWidth: true,
|
|
||||||
borderLeftWidth: true,
|
|
||||||
borderRightWidth: true,
|
|
||||||
borderBlockWidth: true,
|
|
||||||
borderBlockEndWidth: true,
|
|
||||||
borderBlockStartWidth: true,
|
|
||||||
borderInlineWidth: true,
|
|
||||||
borderInlineEndWidth: true,
|
|
||||||
borderInlineStartWidth: true,
|
|
||||||
borderStyle: true,
|
|
||||||
borderBlockStyle: true,
|
|
||||||
borderBlockEndStyle: true,
|
|
||||||
borderBlockStartStyle: true,
|
|
||||||
borderInlineStyle: true,
|
|
||||||
borderInlineEndStyle: true,
|
|
||||||
borderInlineStartStyle: true,
|
|
||||||
borderTopEndRadius: true,
|
|
||||||
borderTopStartRadius: true,
|
|
||||||
borderTopWidth: true,
|
|
||||||
borderWidth: true,
|
|
||||||
transform: true,
|
|
||||||
transformOrigin: true,
|
|
||||||
alignContent: true,
|
|
||||||
alignItems: true,
|
|
||||||
alignSelf: true,
|
|
||||||
borderEndWidth: true,
|
|
||||||
borderStartWidth: true,
|
|
||||||
bottom: true,
|
|
||||||
display: true,
|
|
||||||
end: true,
|
|
||||||
flexBasis: true,
|
|
||||||
flexDirection: true,
|
|
||||||
flexWrap: true,
|
|
||||||
gap: true,
|
|
||||||
columnGap: true,
|
|
||||||
rowGap: true,
|
|
||||||
justifyContent: true,
|
|
||||||
left: true,
|
|
||||||
margin: true,
|
|
||||||
marginBlock: true,
|
|
||||||
marginBlockEnd: true,
|
|
||||||
marginBlockStart: true,
|
|
||||||
marginInline: true,
|
|
||||||
marginInlineStart: true,
|
|
||||||
marginInlineEnd: true,
|
|
||||||
marginBottom: true,
|
|
||||||
marginEnd: true,
|
|
||||||
marginHorizontal: true,
|
|
||||||
marginLeft: true,
|
|
||||||
marginRight: true,
|
|
||||||
marginStart: true,
|
|
||||||
marginTop: true,
|
|
||||||
marginVertical: true,
|
|
||||||
overflow: true,
|
|
||||||
padding: true,
|
|
||||||
paddingBottom: true,
|
|
||||||
paddingInline: true,
|
|
||||||
paddingBlock: true,
|
|
||||||
paddingBlockStart: true,
|
|
||||||
paddingInlineEnd: true,
|
|
||||||
paddingInlineStart: true,
|
|
||||||
paddingEnd: true,
|
|
||||||
paddingHorizontal: true,
|
|
||||||
paddingLeft: true,
|
|
||||||
paddingRight: true,
|
|
||||||
paddingStart: true,
|
|
||||||
paddingTop: true,
|
|
||||||
paddingVertical: true,
|
|
||||||
position: true,
|
|
||||||
right: true,
|
|
||||||
start: true,
|
|
||||||
top: true,
|
|
||||||
inset: true,
|
|
||||||
insetBlock: true,
|
|
||||||
insetBlockEnd: true,
|
|
||||||
insetBlockStart: true,
|
|
||||||
insetInline: true,
|
|
||||||
insetInlineEnd: true,
|
|
||||||
insetInlineStart: true,
|
|
||||||
direction: true,
|
|
||||||
shadowOffset: true,
|
|
||||||
shadowRadius: true,
|
|
||||||
...tokenCategories.color,
|
|
||||||
...tokenCategories.radius,
|
|
||||||
...tokenCategories.size,
|
|
||||||
...tokenCategories.radius,
|
|
||||||
...stylePropsTransform,
|
|
||||||
...stylePropsUnitless,
|
|
||||||
boxShadow: true,
|
|
||||||
filter: true,
|
|
||||||
// RN 0.77+ style props (set REACT_NATIVE_PRE_77=1 for older RN)
|
|
||||||
...!process.env.REACT_NATIVE_PRE_77 && {
|
|
||||||
boxSizing: true,
|
|
||||||
mixBlendMode: true,
|
|
||||||
outlineColor: true,
|
|
||||||
outlineSpread: true,
|
|
||||||
outlineStyle: true,
|
|
||||||
outlineWidth: true
|
|
||||||
},
|
|
||||||
// RN doesn't support specific border styles per-edge
|
|
||||||
transition: true,
|
|
||||||
textWrap: true,
|
|
||||||
backdropFilter: true,
|
|
||||||
WebkitBackdropFilter: true,
|
|
||||||
background: true,
|
|
||||||
backgroundAttachment: true,
|
|
||||||
backgroundBlendMode: true,
|
|
||||||
backgroundClip: true,
|
|
||||||
backgroundColor: true,
|
|
||||||
backgroundImage: true,
|
|
||||||
backgroundOrigin: true,
|
|
||||||
backgroundPosition: true,
|
|
||||||
backgroundRepeat: true,
|
|
||||||
backgroundSize: true,
|
|
||||||
borderBottomStyle: true,
|
|
||||||
borderImage: true,
|
|
||||||
borderLeftStyle: true,
|
|
||||||
borderRightStyle: true,
|
|
||||||
borderTopStyle: true,
|
|
||||||
caretColor: true,
|
|
||||||
clipPath: true,
|
|
||||||
contain: true,
|
|
||||||
containerType: true,
|
|
||||||
content: true,
|
|
||||||
cursor: true,
|
|
||||||
float: true,
|
|
||||||
mask: true,
|
|
||||||
maskBorder: true,
|
|
||||||
maskBorderMode: true,
|
|
||||||
maskBorderOutset: true,
|
|
||||||
maskBorderRepeat: true,
|
|
||||||
maskBorderSlice: true,
|
|
||||||
maskBorderSource: true,
|
|
||||||
maskBorderWidth: true,
|
|
||||||
maskClip: true,
|
|
||||||
maskComposite: true,
|
|
||||||
maskImage: true,
|
|
||||||
maskMode: true,
|
|
||||||
maskOrigin: true,
|
|
||||||
maskPosition: true,
|
|
||||||
maskRepeat: true,
|
|
||||||
maskSize: true,
|
|
||||||
maskType: true,
|
|
||||||
objectFit: true,
|
|
||||||
objectPosition: true,
|
|
||||||
outlineOffset: true,
|
|
||||||
overflowBlock: true,
|
|
||||||
overflowInline: true,
|
|
||||||
overflowX: true,
|
|
||||||
overflowY: true,
|
|
||||||
pointerEvents: true,
|
|
||||||
scrollbarWidth: true,
|
|
||||||
textEmphasis: true,
|
|
||||||
touchAction: true,
|
|
||||||
transformStyle: true,
|
|
||||||
userSelect: true,
|
|
||||||
willChange: true,
|
|
||||||
...isAndroid ? {
|
|
||||||
elevationAndroid: true
|
|
||||||
} : {}
|
|
||||||
};
|
|
||||||
var stylePropsFont = {
|
|
||||||
fontFamily: true,
|
|
||||||
fontSize: true,
|
|
||||||
fontStyle: true,
|
|
||||||
fontWeight: true,
|
|
||||||
fontVariant: true,
|
|
||||||
letterSpacing: true,
|
|
||||||
lineHeight: true,
|
|
||||||
textTransform: true
|
|
||||||
};
|
|
||||||
var stylePropsTextOnly = {
|
|
||||||
...stylePropsFont,
|
|
||||||
textAlign: true,
|
|
||||||
textDecorationLine: true,
|
|
||||||
textDecorationStyle: true,
|
|
||||||
...textColors,
|
|
||||||
textShadowOffset: true,
|
|
||||||
textShadowRadius: true,
|
|
||||||
userSelect: true,
|
|
||||||
selectable: true,
|
|
||||||
verticalAlign: true,
|
|
||||||
whiteSpace: true,
|
|
||||||
wordWrap: true,
|
|
||||||
textOverflow: true,
|
|
||||||
textDecorationDistance: true,
|
|
||||||
cursor: true,
|
|
||||||
WebkitLineClamp: true,
|
|
||||||
WebkitBoxOrient: true
|
|
||||||
};
|
|
||||||
var stylePropsText = {
|
|
||||||
...stylePropsView,
|
|
||||||
...stylePropsTextOnly
|
|
||||||
};
|
|
||||||
|
|
||||||
// node_modules/@tamagui/helpers/dist/esm/withStaticProperties.mjs
|
// node_modules/@tamagui/helpers/dist/esm/withStaticProperties.mjs
|
||||||
var import_react2 = __toESM(require("react"), 1);
|
var import_react2 = __toESM(require("react"), 1);
|
||||||
var Decorated = Symbol();
|
var Decorated = Symbol();
|
||||||
@@ -755,7 +444,10 @@ var SizableText2 = (0, import_web4.styled)(import_web4.Text, {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
SizableText2.staticConfig.variants.fontFamily = {
|
SizableText2.staticConfig.variants.fontFamily = {
|
||||||
"...": /* @__PURE__ */ __name((_val, extras) => {
|
"...": /* @__PURE__ */ __name((val, extras) => {
|
||||||
|
if (val === "inherit") return {
|
||||||
|
fontFamily: "inherit"
|
||||||
|
};
|
||||||
const sizeProp = extras.props.size, fontSizeProp = extras.props.fontSize, size = sizeProp === "$true" && fontSizeProp ? fontSizeProp : extras.props.size || "$true";
|
const sizeProp = extras.props.size, fontSizeProp = extras.props.fontSize, size = sizeProp === "$true" && fontSizeProp ? fontSizeProp : extras.props.size || "$true";
|
||||||
return getFontSized(size, extras);
|
return getFontSized(size, extras);
|
||||||
}, "...")
|
}, "...")
|
||||||
|
|||||||
@@ -112,7 +112,10 @@ var SizableText2 = (0, import_web2.styled)(import_web2.Text, {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
SizableText2.staticConfig.variants.fontFamily = {
|
SizableText2.staticConfig.variants.fontFamily = {
|
||||||
"...": /* @__PURE__ */ __name((_val, extras) => {
|
"...": /* @__PURE__ */ __name((val, extras) => {
|
||||||
|
if (val === "inherit") return {
|
||||||
|
fontFamily: "inherit"
|
||||||
|
};
|
||||||
const sizeProp = extras.props.size, fontSizeProp = extras.props.fontSize, size = sizeProp === "$true" && fontSizeProp ? fontSizeProp : extras.props.size || "$true";
|
const sizeProp = extras.props.size, fontSizeProp = extras.props.fontSize, size = sizeProp === "$true" && fontSizeProp ? fontSizeProp : extras.props.size || "$true";
|
||||||
return getFontSized(size, extras);
|
return getFontSized(size, extras);
|
||||||
}, "...")
|
}, "...")
|
||||||
|
|||||||
209
AGENTS.md
209
AGENTS.md
@@ -129,7 +129,7 @@ The Laravel Boost guidelines are specifically curated by Laravel maintainers for
|
|||||||
## Foundational Context
|
## Foundational Context
|
||||||
This application is a Laravel application and its main Laravel ecosystems package & versions are below. You are an expert with them all. Ensure you abide by these specific packages & versions.
|
This application is a Laravel application and its main Laravel ecosystems package & versions are below. You are an expert with them all. Ensure you abide by these specific packages & versions.
|
||||||
|
|
||||||
- php - 8.3.24
|
- php - 8.3.6
|
||||||
- filament/filament (FILAMENT) - v4
|
- filament/filament (FILAMENT) - v4
|
||||||
- inertiajs/inertia-laravel (INERTIA) - v2
|
- inertiajs/inertia-laravel (INERTIA) - v2
|
||||||
- laravel/framework (LARAVEL) - v12
|
- laravel/framework (LARAVEL) - v12
|
||||||
@@ -151,7 +151,7 @@ This application is a Laravel application and its main Laravel ecosystems packag
|
|||||||
- prettier (PRETTIER) - v3
|
- prettier (PRETTIER) - v3
|
||||||
|
|
||||||
## Conventions
|
## Conventions
|
||||||
- You must follow all existing code conventions used in this application. When creating or editing a file, check sibling files for the correct structure, approach, naming.
|
- You must follow all existing code conventions used in this application. When creating or editing a file, check sibling files for the correct structure, approach, and naming.
|
||||||
- Use descriptive names for variables and methods. For example, `isRegisteredForDiscounts`, not `discount()`.
|
- Use descriptive names for variables and methods. For example, `isRegisteredForDiscounts`, not `discount()`.
|
||||||
- Check for existing components to reuse before writing a new one.
|
- Check for existing components to reuse before writing a new one.
|
||||||
|
|
||||||
@@ -159,7 +159,7 @@ This application is a Laravel application and its main Laravel ecosystems packag
|
|||||||
- Do not create verification scripts or tinker when tests cover that functionality and prove it works. Unit and feature tests are more important.
|
- Do not create verification scripts or tinker when tests cover that functionality and prove it works. Unit and feature tests are more important.
|
||||||
|
|
||||||
## Application Structure & Architecture
|
## Application Structure & Architecture
|
||||||
- Stick to existing directory structure - don't create new base folders without approval.
|
- Stick to existing directory structure; don't create new base folders without approval.
|
||||||
- Do not change the application's dependencies without approval.
|
- Do not change the application's dependencies without approval.
|
||||||
|
|
||||||
## Frontend Bundling
|
## Frontend Bundling
|
||||||
@@ -171,17 +171,16 @@ This application is a Laravel application and its main Laravel ecosystems packag
|
|||||||
## Documentation Files
|
## Documentation Files
|
||||||
- You must only create documentation files if explicitly requested by the user.
|
- You must only create documentation files if explicitly requested by the user.
|
||||||
|
|
||||||
|
|
||||||
=== boost rules ===
|
=== boost rules ===
|
||||||
|
|
||||||
## Laravel Boost
|
## Laravel Boost
|
||||||
- Laravel Boost is an MCP server that comes with powerful tools designed specifically for this application. Use them.
|
- Laravel Boost is an MCP server that comes with powerful tools designed specifically for this application. Use them.
|
||||||
|
|
||||||
## Artisan
|
## Artisan
|
||||||
- Use the `list-artisan-commands` tool when you need to call an Artisan command to double check the available parameters.
|
- Use the `list-artisan-commands` tool when you need to call an Artisan command to double-check the available parameters.
|
||||||
|
|
||||||
## URLs
|
## URLs
|
||||||
- Whenever you share a project URL with the user you should use the `get-absolute-url` tool to ensure you're using the correct scheme, domain / IP, and port.
|
- Whenever you share a project URL with the user, you should use the `get-absolute-url` tool to ensure you're using the correct scheme, domain/IP, and port.
|
||||||
|
|
||||||
## Tinker / Debugging
|
## Tinker / Debugging
|
||||||
- You should use the `tinker` tool when you need to execute PHP to debug code or query Eloquent models directly.
|
- You should use the `tinker` tool when you need to execute PHP to debug code or query Eloquent models directly.
|
||||||
@@ -192,22 +191,21 @@ This application is a Laravel application and its main Laravel ecosystems packag
|
|||||||
- Only recent browser logs will be useful - ignore old logs.
|
- Only recent browser logs will be useful - ignore old logs.
|
||||||
|
|
||||||
## Searching Documentation (Critically Important)
|
## Searching Documentation (Critically Important)
|
||||||
- Boost comes with a powerful `search-docs` tool you should use before any other approaches. This tool automatically passes a list of installed packages and their versions to the remote Boost API, so it returns only version-specific documentation specific for the user's circumstance. You should pass an array of packages to filter on if you know you need docs for particular packages.
|
- Boost comes with a powerful `search-docs` tool you should use before any other approaches when dealing with Laravel or Laravel ecosystem packages. This tool automatically passes a list of installed packages and their versions to the remote Boost API, so it returns only version-specific documentation for the user's circumstance. You should pass an array of packages to filter on if you know you need docs for particular packages.
|
||||||
- The 'search-docs' tool is perfect for all Laravel related packages, including Laravel, Inertia, Livewire, Filament, Tailwind, Pest, Nova, Nightwatch, etc.
|
- The `search-docs` tool is perfect for all Laravel-related packages, including Laravel, Inertia, Livewire, Filament, Tailwind, Pest, Nova, Nightwatch, etc.
|
||||||
- You must use this tool to search for Laravel-ecosystem documentation before falling back to other approaches.
|
- You must use this tool to search for Laravel ecosystem documentation before falling back to other approaches.
|
||||||
- Search the documentation before making code changes to ensure we are taking the correct approach.
|
- Search the documentation before making code changes to ensure we are taking the correct approach.
|
||||||
- Use multiple, broad, simple, topic based queries to start. For example: `['rate limiting', 'routing rate limiting', 'routing']`.
|
- Use multiple, broad, simple, topic-based queries to start. For example: `['rate limiting', 'routing rate limiting', 'routing']`.
|
||||||
- Do not add package names to queries - package information is already shared. For example, use `test resource table`, not `filament 4 test resource table`.
|
- Do not add package names to queries; package information is already shared. For example, use `test resource table`, not `filament 4 test resource table`.
|
||||||
|
|
||||||
### Available Search Syntax
|
### Available Search Syntax
|
||||||
- You can and should pass multiple queries at once. The most relevant results will be returned first.
|
- You can and should pass multiple queries at once. The most relevant results will be returned first.
|
||||||
|
|
||||||
1. Simple Word Searches with auto-stemming - query=authentication - finds 'authenticate' and 'auth'
|
1. Simple Word Searches with auto-stemming - query=authentication - finds 'authenticate' and 'auth'.
|
||||||
2. Multiple Words (AND Logic) - query=rate limit - finds knowledge containing both "rate" AND "limit"
|
2. Multiple Words (AND Logic) - query=rate limit - finds knowledge containing both "rate" AND "limit".
|
||||||
3. Quoted Phrases (Exact Position) - query="infinite scroll" - Words must be adjacent and in that order
|
3. Quoted Phrases (Exact Position) - query="infinite scroll" - words must be adjacent and in that order.
|
||||||
4. Mixed Queries - query=middleware "rate limit" - "middleware" AND exact phrase "rate limit"
|
4. Mixed Queries - query=middleware "rate limit" - "middleware" AND exact phrase "rate limit".
|
||||||
5. Multiple Queries - queries=["authentication", "middleware"] - ANY of these terms
|
5. Multiple Queries - queries=["authentication", "middleware"] - ANY of these terms.
|
||||||
|
|
||||||
|
|
||||||
=== php rules ===
|
=== php rules ===
|
||||||
|
|
||||||
@@ -218,7 +216,7 @@ This application is a Laravel application and its main Laravel ecosystems packag
|
|||||||
### Constructors
|
### Constructors
|
||||||
- Use PHP 8 constructor property promotion in `__construct()`.
|
- Use PHP 8 constructor property promotion in `__construct()`.
|
||||||
- <code-snippet>public function __construct(public GitHub $github) { }</code-snippet>
|
- <code-snippet>public function __construct(public GitHub $github) { }</code-snippet>
|
||||||
- Do not allow empty `__construct()` methods with zero parameters.
|
- Do not allow empty `__construct()` methods with zero parameters unless the constructor is private.
|
||||||
|
|
||||||
### Type Declarations
|
### Type Declarations
|
||||||
- Always use explicit return type declarations for methods and functions.
|
- Always use explicit return type declarations for methods and functions.
|
||||||
@@ -232,7 +230,7 @@ protected function isAccessible(User $user, ?string $path = null): bool
|
|||||||
</code-snippet>
|
</code-snippet>
|
||||||
|
|
||||||
## Comments
|
## Comments
|
||||||
- Prefer PHPDoc blocks over comments. Never use comments within the code itself unless there is something _very_ complex going on.
|
- Prefer PHPDoc blocks over inline comments. Never use comments within the code itself unless there is something very complex going on.
|
||||||
|
|
||||||
## PHPDoc Blocks
|
## PHPDoc Blocks
|
||||||
- Add useful array shape type definitions for arrays when appropriate.
|
- Add useful array shape type definitions for arrays when appropriate.
|
||||||
@@ -240,32 +238,22 @@ protected function isAccessible(User $user, ?string $path = null): bool
|
|||||||
## Enums
|
## Enums
|
||||||
- Typically, keys in an Enum should be TitleCase. For example: `FavoritePerson`, `BestLake`, `Monthly`.
|
- Typically, keys in an Enum should be TitleCase. For example: `FavoritePerson`, `BestLake`, `Monthly`.
|
||||||
|
|
||||||
|
|
||||||
=== herd rules ===
|
|
||||||
|
|
||||||
## Laravel Herd
|
|
||||||
|
|
||||||
- The application is served by Laravel Herd and will be available at: https?://[kebab-case-project-dir].test. Use the `get-absolute-url` tool to generate URLs for the user to ensure valid URLs.
|
|
||||||
- You must not run any commands to make the site available via HTTP(s). It is _always_ available through Laravel Herd.
|
|
||||||
|
|
||||||
|
|
||||||
=== tests rules ===
|
=== tests rules ===
|
||||||
|
|
||||||
## Test Enforcement
|
## Test Enforcement
|
||||||
|
|
||||||
- Every change must be programmatically tested. Write a new test or update an existing test, then run the affected tests to make sure they pass.
|
- Every change must be programmatically tested. Write a new test or update an existing test, then run the affected tests to make sure they pass.
|
||||||
- Run the minimum number of tests needed to ensure code quality and speed. Use `php artisan test` with a specific filename or filter.
|
- Run the minimum number of tests needed to ensure code quality and speed. Use `php artisan test --compact` with a specific filename or filter.
|
||||||
|
|
||||||
|
|
||||||
=== inertia-laravel/core rules ===
|
=== inertia-laravel/core rules ===
|
||||||
|
|
||||||
## Inertia Core
|
## Inertia
|
||||||
|
|
||||||
- Inertia.js components should be placed in the `resources/js/pages` directory unless specified differently in the JS bundler (vite.config.js).
|
- Inertia.js components should be placed in the `resources/js/Pages` directory unless specified differently in the JS bundler (`vite.config.js`).
|
||||||
- Use `Inertia::render()` for server-side routing instead of traditional Blade views.
|
- Use `Inertia::render()` for server-side routing instead of traditional Blade views.
|
||||||
- Use `search-docs` for accurate guidance on all things Inertia.
|
- Use the `search-docs` tool for accurate guidance on all things Inertia.
|
||||||
|
|
||||||
<code-snippet lang="php" name="Inertia::render Example">
|
<code-snippet name="Inertia Render Example" lang="php">
|
||||||
// routes/web.php example
|
// routes/web.php example
|
||||||
Route::get('/users', function () {
|
Route::get('/users', function () {
|
||||||
return Inertia::render('Users/Index', [
|
return Inertia::render('Users/Index', [
|
||||||
@@ -274,28 +262,26 @@ Route::get('/users', function () {
|
|||||||
});
|
});
|
||||||
</code-snippet>
|
</code-snippet>
|
||||||
|
|
||||||
|
|
||||||
=== inertia-laravel/v2 rules ===
|
=== inertia-laravel/v2 rules ===
|
||||||
|
|
||||||
## Inertia v2
|
## Inertia v2
|
||||||
|
|
||||||
- Make use of all Inertia features from v1 & v2. Check the documentation before making any changes to ensure we are taking the correct approach.
|
- Make use of all Inertia features from v1 and v2. Check the documentation before making any changes to ensure we are taking the correct approach.
|
||||||
|
|
||||||
### Inertia v2 New Features
|
### Inertia v2 New Features
|
||||||
- Polling
|
- Deferred props.
|
||||||
- Prefetching
|
- Infinite scrolling using merging props and `WhenVisible`.
|
||||||
- Deferred props
|
- Lazy loading data on scroll.
|
||||||
- Infinite scrolling using merging props and `WhenVisible`
|
- Polling.
|
||||||
- Lazy loading data on scroll
|
- Prefetching.
|
||||||
|
|
||||||
### Deferred Props & Empty States
|
### Deferred Props & Empty States
|
||||||
- When using deferred props on the frontend, you should add a nice empty state with pulsing / animated skeleton.
|
- When using deferred props on the frontend, you should add a nice empty state with pulsing/animated skeleton.
|
||||||
|
|
||||||
### Inertia Form General Guidance
|
### Inertia Form General Guidance
|
||||||
- The recommended way to build forms when using Inertia is with the `<Form>` component - a useful example is below. Use `search-docs` with a query of `form component` for guidance.
|
- The recommended way to build forms when using Inertia is with the `<Form>` component - a useful example is below. Use the `search-docs` tool with a query of `form component` for guidance.
|
||||||
- Forms can also be built using the `useForm` helper for more programmatic control, or to follow existing conventions. Use `search-docs` with a query of `useForm helper` for guidance.
|
- Forms can also be built using the `useForm` helper for more programmatic control, or to follow existing conventions. Use the `search-docs` tool with a query of `useForm helper` for guidance.
|
||||||
- `resetOnError`, `resetOnSuccess`, and `setDefaultsOnSuccess` are available on the `<Form>` component. Use `search-docs` with a query of 'form component resetting' for guidance.
|
- `resetOnError`, `resetOnSuccess`, and `setDefaultsOnSuccess` are available on the `<Form>` component. Use the `search-docs` tool with a query of `form component resetting` for guidance.
|
||||||
|
|
||||||
|
|
||||||
=== laravel/core rules ===
|
=== laravel/core rules ===
|
||||||
|
|
||||||
@@ -307,7 +293,7 @@ Route::get('/users', function () {
|
|||||||
|
|
||||||
### Database
|
### Database
|
||||||
- Always use proper Eloquent relationship methods with return type hints. Prefer relationship methods over raw queries or manual joins.
|
- Always use proper Eloquent relationship methods with return type hints. Prefer relationship methods over raw queries or manual joins.
|
||||||
- Use Eloquent models and relationships before suggesting raw database queries
|
- Use Eloquent models and relationships before suggesting raw database queries.
|
||||||
- Avoid `DB::`; prefer `Model::query()`. Generate code that leverages Laravel's ORM capabilities rather than bypassing them.
|
- Avoid `DB::`; prefer `Model::query()`. Generate code that leverages Laravel's ORM capabilities rather than bypassing them.
|
||||||
- Generate code that prevents N+1 query problems by using eager loading.
|
- Generate code that prevents N+1 query problems by using eager loading.
|
||||||
- Use Laravel's query builder for very complex database operations.
|
- Use Laravel's query builder for very complex database operations.
|
||||||
@@ -342,52 +328,56 @@ Route::get('/users', function () {
|
|||||||
### Vite Error
|
### Vite Error
|
||||||
- If you receive an "Illuminate\Foundation\ViteException: Unable to locate file in Vite manifest" error, you can run `npm run build` or ask the user to run `npm run dev` or `composer run dev`.
|
- If you receive an "Illuminate\Foundation\ViteException: Unable to locate file in Vite manifest" error, you can run `npm run build` or ask the user to run `npm run dev` or `composer run dev`.
|
||||||
|
|
||||||
|
|
||||||
=== laravel/v12 rules ===
|
=== laravel/v12 rules ===
|
||||||
|
|
||||||
## Laravel 12
|
## Laravel 12
|
||||||
|
|
||||||
- Use the `search-docs` tool to get version specific documentation.
|
- Use the `search-docs` tool to get version-specific documentation.
|
||||||
- This project upgraded from Laravel 10 without migrating to the new streamlined Laravel file structure.
|
- This project upgraded from Laravel 10 without migrating to the new streamlined Laravel file structure.
|
||||||
- This is **perfectly fine** and recommended by Laravel. Follow the existing structure from Laravel 10. We do not to need migrate to the new Laravel structure unless the user explicitly requests that.
|
- This is **perfectly fine** and recommended by Laravel. Follow the existing structure from Laravel 10. We do not need to migrate to the new Laravel structure unless the user explicitly requests it.
|
||||||
|
|
||||||
|
|
||||||
|
### Laravel 10 Structure
|
||||||
|
- Middleware typically lives in `app/Http/Middleware/` and service providers in `app/Providers/`.
|
||||||
|
- There is no `bootstrap/app.php` application configuration in a Laravel 10 structure:
|
||||||
|
- Middleware registration happens in `app/Http/Kernel.php`
|
||||||
|
- Exception handling is in `app/Exceptions/Handler.php`
|
||||||
|
- Console commands and schedule register in `app/Console/Kernel.php`
|
||||||
|
- Rate limits likely exist in `RouteServiceProvider` or `app/Http/Kernel.php`
|
||||||
|
|
||||||
### Database
|
### Database
|
||||||
- When modifying a column, the migration must include all of the attributes that were previously defined on the column. Otherwise, they will be dropped and lost.
|
- When modifying a column, the migration must include all of the attributes that were previously defined on the column. Otherwise, they will be dropped and lost.
|
||||||
- Laravel 11 allows limiting eagerly loaded records natively, without external packages: `$query->latest()->limit(10);`.
|
- Laravel 12 allows limiting eagerly loaded records natively, without external packages: `$query->latest()->limit(10);`.
|
||||||
|
|
||||||
### Models
|
### Models
|
||||||
- Casts can and likely should be set in a `casts()` method on a model rather than the `$casts` property. Follow existing conventions from other models.
|
- Casts can and likely should be set in a `casts()` method on a model rather than the `$casts` property. Follow existing conventions from other models.
|
||||||
|
|
||||||
|
|
||||||
=== wayfinder/core rules ===
|
=== wayfinder/core rules ===
|
||||||
|
|
||||||
## Laravel Wayfinder
|
## Laravel Wayfinder
|
||||||
|
|
||||||
Wayfinder generates TypeScript functions and types for Laravel controllers and routes which you can import into your client side code. It provides type safety and automatic synchronization between backend routes and frontend code.
|
Wayfinder generates TypeScript functions and types for Laravel controllers and routes which you can import into your client-side code. It provides type safety and automatic synchronization between backend routes and frontend code.
|
||||||
|
|
||||||
### Development Guidelines
|
### Development Guidelines
|
||||||
- Always use `search-docs` to check wayfinder correct usage before implementing any features.
|
- Always use the `search-docs` tool to check Wayfinder correct usage before implementing any features.
|
||||||
- Always Prefer named imports for tree-shaking (e.g., `import { show } from '@/actions/...'`)
|
- Always prefer named imports for tree-shaking (e.g., `import { show } from '@/actions/...'`).
|
||||||
- Avoid default controller imports (prevents tree-shaking)
|
- Avoid default controller imports (prevents tree-shaking).
|
||||||
- Run `php artisan wayfinder:generate` after route changes if Vite plugin isn't installed
|
- Run `php artisan wayfinder:generate` after route changes if Vite plugin isn't installed.
|
||||||
|
|
||||||
### Feature Overview
|
### Feature Overview
|
||||||
- Form Support: Use `.form()` with `--with-form` flag for HTML form attributes — `<form {...store.form()}>` → `action="/posts" method="post"`
|
- Form Support: Use `.form()` with `--with-form` flag for HTML form attributes — `<form {...store.form()}>` → `action="/posts" method="post"`.
|
||||||
- HTTP Methods: Call `.get()`, `.post()`, `.patch()`, `.put()`, `.delete()` for specific methods — `show.head(1)` → `{ url: "/posts/1", method: "head" }`
|
- HTTP Methods: Call `.get()`, `.post()`, `.patch()`, `.put()`, `.delete()` for specific methods — `show.head(1)` → `{ url: "/posts/1", method: "head" }`.
|
||||||
- Invokable Controllers: Import and invoke directly as functions. For example, `import StorePost from '@/actions/.../StorePostController'; StorePost()`
|
- Invokable Controllers: Import and invoke directly as functions. For example, `import StorePost from '@/actions/.../StorePostController'; StorePost()`.
|
||||||
- Named Routes: Import from `@/routes/` for non-controller routes. For example, `import { show } from '@/routes/post'; show(1)` for route name `post.show`
|
- Named Routes: Import from `@/routes/` for non-controller routes. For example, `import { show } from '@/routes/post'; show(1)` for route name `post.show`.
|
||||||
- Parameter Binding: Detects route keys (e.g., `{post:slug}`) and accepts matching object properties — `show("my-post")` or `show({ slug: "my-post" })`
|
- Parameter Binding: Detects route keys (e.g., `{post:slug}`) and accepts matching object properties — `show("my-post")` or `show({ slug: "my-post" })`.
|
||||||
- Query Merging: Use `mergeQuery` to merge with `window.location.search`, set values to `null` to remove — `show(1, { mergeQuery: { page: 2, sort: null } })`
|
- Query Merging: Use `mergeQuery` to merge with `window.location.search`, set values to `null` to remove — `show(1, { mergeQuery: { page: 2, sort: null } })`.
|
||||||
- Query Parameters: Pass `{ query: {...} }` in options to append params — `show(1, { query: { page: 1 } })` → `"/posts/1?page=1"`
|
- Query Parameters: Pass `{ query: {...} }` in options to append params — `show(1, { query: { page: 1 } })` → `"/posts/1?page=1"`.
|
||||||
- Route Objects: Functions return `{ url, method }` shaped objects — `show(1)` → `{ url: "/posts/1", method: "get" }`
|
- Route Objects: Functions return `{ url, method }` shaped objects — `show(1)` → `{ url: "/posts/1", method: "get" }`.
|
||||||
- URL Extraction: Use `.url()` to get URL string — `show.url(1)` → `"/posts/1"`
|
- URL Extraction: Use `.url()` to get URL string — `show.url(1)` → `"/posts/1"`.
|
||||||
|
|
||||||
### Example Usage
|
### Example Usage
|
||||||
|
|
||||||
<code-snippet name="Wayfinder Basic Usage" lang="typescript">
|
<code-snippet name="Wayfinder Basic Usage" lang="typescript">
|
||||||
// Import controller methods (tree-shakable)
|
// Import controller methods (tree-shakable)...
|
||||||
import { show, store, update } from '@/actions/App/Http/Controllers/PostController'
|
import { show, store, update } from '@/actions/App/Http/Controllers/PostController'
|
||||||
|
|
||||||
// Get route object with URL and method...
|
// Get route object with URL and method...
|
||||||
@@ -405,7 +395,6 @@ Wayfinder generates TypeScript functions and types for Laravel controllers and r
|
|||||||
postShow(1) // { url: "/posts/1", method: "get" }
|
postShow(1) // { url: "/posts/1", method: "get" }
|
||||||
</code-snippet>
|
</code-snippet>
|
||||||
|
|
||||||
|
|
||||||
### Wayfinder + Inertia
|
### Wayfinder + Inertia
|
||||||
If your application uses the `<Form>` component from Inertia, you can use Wayfinder to generate form action and method automatically.
|
If your application uses the `<Form>` component from Inertia, you can use Wayfinder to generate form action and method automatically.
|
||||||
<code-snippet name="Wayfinder Form Component (React)" lang="typescript">
|
<code-snippet name="Wayfinder Form Component (React)" lang="typescript">
|
||||||
@@ -414,14 +403,14 @@ If your application uses the `<Form>` component from Inertia, you can use Wayfin
|
|||||||
|
|
||||||
</code-snippet>
|
</code-snippet>
|
||||||
|
|
||||||
|
|
||||||
=== livewire/core rules ===
|
=== livewire/core rules ===
|
||||||
|
|
||||||
## Livewire Core
|
## Livewire
|
||||||
- Use the `search-docs` tool to find exact version specific documentation for how to write Livewire & Livewire tests.
|
|
||||||
- Use the `php artisan make:livewire [Posts\CreatePost]` artisan command to create new components
|
- Use the `search-docs` tool to find exact version-specific documentation for how to write Livewire and Livewire tests.
|
||||||
|
- Use the `php artisan make:livewire [Posts\CreatePost]` Artisan command to create new components.
|
||||||
- State should live on the server, with the UI reflecting it.
|
- State should live on the server, with the UI reflecting it.
|
||||||
- All Livewire requests hit the Laravel backend, they're like regular HTTP requests. Always validate form data, and run authorization checks in Livewire actions.
|
- All Livewire requests hit the Laravel backend; they're like regular HTTP requests. Always validate form data and run authorization checks in Livewire actions.
|
||||||
|
|
||||||
## Livewire Best Practices
|
## Livewire Best Practices
|
||||||
- Livewire components require a single root element.
|
- Livewire components require a single root element.
|
||||||
@@ -438,15 +427,14 @@ If your application uses the `<Form>` component from Inertia, you can use Wayfin
|
|||||||
|
|
||||||
- Prefer lifecycle hooks like `mount()`, `updatedFoo()` for initialization and reactive side effects:
|
- Prefer lifecycle hooks like `mount()`, `updatedFoo()` for initialization and reactive side effects:
|
||||||
|
|
||||||
<code-snippet name="Lifecycle hook examples" lang="php">
|
<code-snippet name="Lifecycle Hook Examples" lang="php">
|
||||||
public function mount(User $user) { $this->user = $user; }
|
public function mount(User $user) { $this->user = $user; }
|
||||||
public function updatedSearch() { $this->resetPage(); }
|
public function updatedSearch() { $this->resetPage(); }
|
||||||
</code-snippet>
|
</code-snippet>
|
||||||
|
|
||||||
|
|
||||||
## Testing Livewire
|
## Testing Livewire
|
||||||
|
|
||||||
<code-snippet name="Example Livewire component test" lang="php">
|
<code-snippet name="Example Livewire Component Test" lang="php">
|
||||||
Livewire::test(Counter::class)
|
Livewire::test(Counter::class)
|
||||||
->assertSet('count', 0)
|
->assertSet('count', 0)
|
||||||
->call('increment')
|
->call('increment')
|
||||||
@@ -455,19 +443,17 @@ If your application uses the `<Form>` component from Inertia, you can use Wayfin
|
|||||||
->assertStatus(200);
|
->assertStatus(200);
|
||||||
</code-snippet>
|
</code-snippet>
|
||||||
|
|
||||||
|
<code-snippet name="Testing Livewire Component Exists on Page" lang="php">
|
||||||
<code-snippet name="Testing a Livewire component exists within a page" lang="php">
|
$this->get('/posts/create')
|
||||||
$this->get('/posts/create')
|
->assertSeeLivewire(CreatePost::class);
|
||||||
->assertSeeLivewire(CreatePost::class);
|
</code-snippet>
|
||||||
</code-snippet>
|
|
||||||
|
|
||||||
|
|
||||||
=== livewire/v3 rules ===
|
=== livewire/v3 rules ===
|
||||||
|
|
||||||
## Livewire 3
|
## Livewire 3
|
||||||
|
|
||||||
### Key Changes From Livewire 2
|
### Key Changes From Livewire 2
|
||||||
- These things changed in Livewire 2, but may not have been updated in this application. Verify this application's setup to ensure you conform with application conventions.
|
- These things changed in Livewire 3, but may not have been updated in this application. Verify this application's setup to ensure you conform with application conventions.
|
||||||
- Use `wire:model.live` for real-time updates, `wire:model` is now deferred by default.
|
- Use `wire:model.live` for real-time updates, `wire:model` is now deferred by default.
|
||||||
- Components now use the `App\Livewire` namespace (not `App\Http\Livewire`).
|
- Components now use the `App\Livewire` namespace (not `App\Http\Livewire`).
|
||||||
- Use `$this->dispatch()` to dispatch events (not `emit` or `dispatchBrowserEvent`).
|
- Use `$this->dispatch()` to dispatch events (not `emit` or `dispatchBrowserEvent`).
|
||||||
@@ -477,13 +463,13 @@ If your application uses the `<Form>` component from Inertia, you can use Wayfin
|
|||||||
- `wire:show`, `wire:transition`, `wire:cloak`, `wire:offline`, `wire:target` are available for use. Use the documentation to find usage examples.
|
- `wire:show`, `wire:transition`, `wire:cloak`, `wire:offline`, `wire:target` are available for use. Use the documentation to find usage examples.
|
||||||
|
|
||||||
### Alpine
|
### Alpine
|
||||||
- Alpine is now included with Livewire, don't manually include Alpine.js.
|
- Alpine is now included with Livewire; don't manually include Alpine.js.
|
||||||
- Plugins included with Alpine: persist, intersect, collapse, and focus.
|
- Plugins included with Alpine: persist, intersect, collapse, and focus.
|
||||||
|
|
||||||
### Lifecycle Hooks
|
### Lifecycle Hooks
|
||||||
- You can listen for `livewire:init` to hook into Livewire initialization, and `fail.status === 419` for the page expiring:
|
- You can listen for `livewire:init` to hook into Livewire initialization, and `fail.status === 419` for the page expiring:
|
||||||
|
|
||||||
<code-snippet name="livewire:load example" lang="js">
|
<code-snippet name="Livewire Init Hook Example" lang="js">
|
||||||
document.addEventListener('livewire:init', function () {
|
document.addEventListener('livewire:init', function () {
|
||||||
Livewire.hook('request', ({ fail }) => {
|
Livewire.hook('request', ({ fail }) => {
|
||||||
if (fail && fail.status === 419) {
|
if (fail && fail.status === 419) {
|
||||||
@@ -497,7 +483,6 @@ document.addEventListener('livewire:init', function () {
|
|||||||
});
|
});
|
||||||
</code-snippet>
|
</code-snippet>
|
||||||
|
|
||||||
|
|
||||||
=== pint/core rules ===
|
=== pint/core rules ===
|
||||||
|
|
||||||
## Laravel Pint Code Formatter
|
## Laravel Pint Code Formatter
|
||||||
@@ -505,24 +490,22 @@ document.addEventListener('livewire:init', function () {
|
|||||||
- You must run `vendor/bin/pint --dirty` before finalizing changes to ensure your code matches the project's expected style.
|
- You must run `vendor/bin/pint --dirty` before finalizing changes to ensure your code matches the project's expected style.
|
||||||
- Do not run `vendor/bin/pint --test`, simply run `vendor/bin/pint` to fix any formatting issues.
|
- Do not run `vendor/bin/pint --test`, simply run `vendor/bin/pint` to fix any formatting issues.
|
||||||
|
|
||||||
|
|
||||||
=== phpunit/core rules ===
|
=== phpunit/core rules ===
|
||||||
|
|
||||||
## PHPUnit Core
|
## PHPUnit
|
||||||
|
|
||||||
- This application uses PHPUnit for testing. All tests must be written as PHPUnit classes. Use `php artisan make:test --phpunit {name}` to create a new test.
|
- This application uses PHPUnit for testing. All tests must be written as PHPUnit classes. Use `php artisan make:test --phpunit {name}` to create a new test.
|
||||||
- If you see a test using "Pest", convert it to PHPUnit.
|
- If you see a test using "Pest", convert it to PHPUnit.
|
||||||
- Every time a test has been updated, run that singular test.
|
- Every time a test has been updated, run that singular test.
|
||||||
- When the tests relating to your feature are passing, ask the user if they would like to also run the entire test suite to make sure everything is still passing.
|
- When the tests relating to your feature are passing, ask the user if they would like to also run the entire test suite to make sure everything is still passing.
|
||||||
- Tests should test all of the happy paths, failure paths, and weird paths.
|
- Tests should test all of the happy paths, failure paths, and weird paths.
|
||||||
- You must not remove any tests or test files from the tests directory without approval. These are not temporary or helper files, these are core to the application.
|
- You must not remove any tests or test files from the tests directory without approval. These are not temporary or helper files; these are core to the application.
|
||||||
|
|
||||||
### Running Tests
|
### Running Tests
|
||||||
- Run the minimal number of tests, using an appropriate filter, before finalizing.
|
- Run the minimal number of tests, using an appropriate filter, before finalizing.
|
||||||
- To run all tests: `php artisan test`.
|
- To run all tests: `php artisan test --compact`.
|
||||||
- To run all tests in a file: `php artisan test tests/Feature/ExampleTest.php`.
|
- To run all tests in a file: `php artisan test --compact tests/Feature/ExampleTest.php`.
|
||||||
- To filter on a particular test name: `php artisan test --filter=testName` (recommended after making a change to a related file).
|
- To filter on a particular test name: `php artisan test --compact --filter=testName` (recommended after making a change to a related file).
|
||||||
|
|
||||||
|
|
||||||
=== inertia-react/core rules ===
|
=== inertia-react/core rules ===
|
||||||
|
|
||||||
@@ -537,10 +520,9 @@ import { Link } from '@inertiajs/react'
|
|||||||
|
|
||||||
</code-snippet>
|
</code-snippet>
|
||||||
|
|
||||||
|
|
||||||
=== inertia-react/v2/forms rules ===
|
=== inertia-react/v2/forms rules ===
|
||||||
|
|
||||||
## Inertia + React Forms
|
## Inertia v2 + React Forms
|
||||||
|
|
||||||
<code-snippet name="`<Form>` Component Example" lang="react">
|
<code-snippet name="`<Form>` Component Example" lang="react">
|
||||||
|
|
||||||
@@ -575,39 +557,37 @@ export default () => (
|
|||||||
|
|
||||||
</code-snippet>
|
</code-snippet>
|
||||||
|
|
||||||
|
|
||||||
=== tailwindcss/core rules ===
|
=== tailwindcss/core rules ===
|
||||||
|
|
||||||
## Tailwind Core
|
## Tailwind CSS
|
||||||
|
|
||||||
- Use Tailwind CSS classes to style HTML, check and use existing tailwind conventions within the project before writing your own.
|
- Use Tailwind CSS classes to style HTML; check and use existing Tailwind conventions within the project before writing your own.
|
||||||
- Offer to extract repeated patterns into components that match the project's conventions (i.e. Blade, JSX, Vue, etc..)
|
- Offer to extract repeated patterns into components that match the project's conventions (i.e. Blade, JSX, Vue, etc.).
|
||||||
- Think through class placement, order, priority, and defaults - remove redundant classes, add classes to parent or child carefully to limit repetition, group elements logically
|
- Think through class placement, order, priority, and defaults. Remove redundant classes, add classes to parent or child carefully to limit repetition, and group elements logically.
|
||||||
- You can use the `search-docs` tool to get exact examples from the official documentation when needed.
|
- You can use the `search-docs` tool to get exact examples from the official documentation when needed.
|
||||||
|
|
||||||
### Spacing
|
### Spacing
|
||||||
- When listing items, use gap utilities for spacing, don't use margins.
|
- When listing items, use gap utilities for spacing; don't use margins.
|
||||||
|
|
||||||
<code-snippet name="Valid Flex Gap Spacing Example" lang="html">
|
|
||||||
<div class="flex gap-8">
|
|
||||||
<div>Superior</div>
|
|
||||||
<div>Michigan</div>
|
|
||||||
<div>Erie</div>
|
|
||||||
</div>
|
|
||||||
</code-snippet>
|
|
||||||
|
|
||||||
|
<code-snippet name="Valid Flex Gap Spacing Example" lang="html">
|
||||||
|
<div class="flex gap-8">
|
||||||
|
<div>Superior</div>
|
||||||
|
<div>Michigan</div>
|
||||||
|
<div>Erie</div>
|
||||||
|
</div>
|
||||||
|
</code-snippet>
|
||||||
|
|
||||||
### Dark Mode
|
### Dark Mode
|
||||||
- If existing pages and components support dark mode, new pages and components must support dark mode in a similar way, typically using `dark:`.
|
- If existing pages and components support dark mode, new pages and components must support dark mode in a similar way, typically using `dark:`.
|
||||||
|
|
||||||
|
|
||||||
=== tailwindcss/v4 rules ===
|
=== tailwindcss/v4 rules ===
|
||||||
|
|
||||||
## Tailwind 4
|
## Tailwind CSS 4
|
||||||
|
|
||||||
- Always use Tailwind CSS v4 - do not use the deprecated utilities.
|
- Always use Tailwind CSS v4; do not use the deprecated utilities.
|
||||||
- `corePlugins` is not supported in Tailwind v4.
|
- `corePlugins` is not supported in Tailwind v4.
|
||||||
- In Tailwind v4, configuration is CSS-first using the `@theme` directive — no separate `tailwind.config.js` file is needed.
|
- In Tailwind v4, configuration is CSS-first using the `@theme` directive — no separate `tailwind.config.js` file is needed.
|
||||||
|
|
||||||
<code-snippet name="Extending Theme in CSS" lang="css">
|
<code-snippet name="Extending Theme in CSS" lang="css">
|
||||||
@theme {
|
@theme {
|
||||||
--color-brand: oklch(0.72 0.11 178);
|
--color-brand: oklch(0.72 0.11 178);
|
||||||
@@ -623,9 +603,8 @@ export default () => (
|
|||||||
+ @import "tailwindcss";
|
+ @import "tailwindcss";
|
||||||
</code-snippet>
|
</code-snippet>
|
||||||
|
|
||||||
|
|
||||||
### Replaced Utilities
|
### Replaced Utilities
|
||||||
- Tailwind v4 removed deprecated utilities. Do not use the deprecated option - use the replacement.
|
- Tailwind v4 removed deprecated utilities. Do not use the deprecated option; use the replacement.
|
||||||
- Opacity values are still numeric.
|
- Opacity values are still numeric.
|
||||||
|
|
||||||
| Deprecated | Replacement |
|
| Deprecated | Replacement |
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ use App\Models\Tenant;
|
|||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Illuminate\Console\Attributes\AsCommand;
|
use Illuminate\Console\Attributes\AsCommand;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
use Illuminate\Support\Facades\DB;
|
|
||||||
|
|
||||||
#[AsCommand(name: 'tenant:attach-demo-event')]
|
#[AsCommand(name: 'tenant:attach-demo-event')]
|
||||||
class AttachDemoEvent extends Command
|
class AttachDemoEvent extends Command
|
||||||
@@ -25,10 +24,12 @@ class AttachDemoEvent extends Command
|
|||||||
{
|
{
|
||||||
if (! \Illuminate\Support\Facades\Schema::hasTable('events')) {
|
if (! \Illuminate\Support\Facades\Schema::hasTable('events')) {
|
||||||
$this->error("Table 'events' does not exist. Run: php artisan migrate");
|
$this->error("Table 'events' does not exist. Run: php artisan migrate");
|
||||||
|
|
||||||
return self::FAILURE;
|
return self::FAILURE;
|
||||||
}
|
}
|
||||||
if (! \Illuminate\Support\Facades\Schema::hasColumn('events', 'tenant_id')) {
|
if (! \Illuminate\Support\Facades\Schema::hasColumn('events', 'tenant_id')) {
|
||||||
$this->error("Column 'events.tenant_id' does not exist. Add it and rerun. Suggested: create a migration to add a nullable foreignId to tenants.");
|
$this->error("Column 'events.tenant_id' does not exist. Add it and rerun. Suggested: create a migration to add a nullable foreignId to tenants.");
|
||||||
|
|
||||||
return self::FAILURE;
|
return self::FAILURE;
|
||||||
}
|
}
|
||||||
$tenant = null;
|
$tenant = null;
|
||||||
@@ -45,6 +46,7 @@ class AttachDemoEvent extends Command
|
|||||||
}
|
}
|
||||||
if (! $tenant) {
|
if (! $tenant) {
|
||||||
$this->error('Tenant not found. Provide --tenant-slug or a user with tenant_id via --tenant-email.');
|
$this->error('Tenant not found. Provide --tenant-slug or a user with tenant_id via --tenant-email.');
|
||||||
|
|
||||||
return self::FAILURE;
|
return self::FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,12 +69,14 @@ class AttachDemoEvent extends Command
|
|||||||
|
|
||||||
if (! $event) {
|
if (! $event) {
|
||||||
$this->error('Event not found. Provide --event-id or --event-slug.');
|
$this->error('Event not found. Provide --event-id or --event-slug.');
|
||||||
|
|
||||||
return self::FAILURE;
|
return self::FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Idempotent update
|
// Idempotent update
|
||||||
if ((int) $event->tenant_id === (int) $tenant->id) {
|
if ((int) $event->tenant_id === (int) $tenant->id) {
|
||||||
$this->info("Event #{$event->id} already attached to tenant #{$tenant->id} ({$tenant->slug}).");
|
$this->info("Event #{$event->id} already attached to tenant #{$tenant->id} ({$tenant->slug}).");
|
||||||
|
|
||||||
return self::SUCCESS;
|
return self::SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,6 +84,7 @@ class AttachDemoEvent extends Command
|
|||||||
$event->save();
|
$event->save();
|
||||||
|
|
||||||
$this->info("Attached event #{$event->id} ({$event->slug}) to tenant #{$tenant->id} ({$tenant->slug}).");
|
$this->info("Attached event #{$event->id} ({$event->slug}) to tenant #{$tenant->id} ({$tenant->slug}).");
|
||||||
|
|
||||||
return self::SUCCESS;
|
return self::SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,22 +10,27 @@ use Illuminate\Support\Facades\Storage;
|
|||||||
class BackfillThumbnails extends Command
|
class BackfillThumbnails extends Command
|
||||||
{
|
{
|
||||||
protected $signature = 'media:backfill-thumbnails {--limit=500}';
|
protected $signature = 'media:backfill-thumbnails {--limit=500}';
|
||||||
|
|
||||||
protected $description = 'Generate thumbnails for photos missing thumbnail_path or where thumbnail equals original.';
|
protected $description = 'Generate thumbnails for photos missing thumbnail_path or where thumbnail equals original.';
|
||||||
|
|
||||||
public function handle(): int
|
public function handle(): int
|
||||||
{
|
{
|
||||||
$limit = (int) $this->option('limit');
|
$limit = (int) $this->option('limit');
|
||||||
$rows = DB::table('photos')
|
$rows = DB::table('photos')
|
||||||
->select(['id','event_id','file_path','thumbnail_path'])
|
->select(['id', 'event_id', 'file_path', 'thumbnail_path'])
|
||||||
->orderBy('id')
|
->orderBy('id')
|
||||||
->limit($limit)
|
->limit($limit)
|
||||||
->get();
|
->get();
|
||||||
$count = 0;
|
$count = 0;
|
||||||
foreach ($rows as $r) {
|
foreach ($rows as $r) {
|
||||||
$orig = $this->relativeFromUrl((string)$r->file_path);
|
$orig = $this->relativeFromUrl((string) $r->file_path);
|
||||||
$thumb = (string)($r->thumbnail_path ?? '');
|
$thumb = (string) ($r->thumbnail_path ?? '');
|
||||||
if ($thumb && $thumb !== $r->file_path) continue; // already set to different thumb
|
if ($thumb && $thumb !== $r->file_path) {
|
||||||
if (! $orig) continue;
|
continue;
|
||||||
|
} // already set to different thumb
|
||||||
|
if (! $orig) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
$baseName = pathinfo($orig, PATHINFO_FILENAME);
|
$baseName = pathinfo($orig, PATHINFO_FILENAME);
|
||||||
$destRel = "events/{$r->event_id}/photos/thumbs/{$baseName}_thumb.jpg";
|
$destRel = "events/{$r->event_id}/photos/thumbs/{$baseName}_thumb.jpg";
|
||||||
$made = ImageHelper::makeThumbnailOnDisk('public', $orig, $destRel, 640, 82);
|
$made = ImageHelper::makeThumbnailOnDisk('public', $orig, $destRel, 640, 82);
|
||||||
@@ -39,6 +44,7 @@ class BackfillThumbnails extends Command
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->info("Done. Thumbnails generated: {$count}");
|
$this->info("Done. Thumbnails generated: {$count}");
|
||||||
|
|
||||||
return self::SUCCESS;
|
return self::SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,6 +55,7 @@ class BackfillThumbnails extends Command
|
|||||||
if (str_starts_with($p, '/storage/')) {
|
if (str_starts_with($p, '/storage/')) {
|
||||||
return substr($p, strlen('/storage/'));
|
return substr($p, strlen('/storage/'));
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,15 +4,15 @@ namespace App\Console\Commands;
|
|||||||
|
|
||||||
use App\Models\PackagePurchase;
|
use App\Models\PackagePurchase;
|
||||||
use App\Models\Tenant;
|
use App\Models\Tenant;
|
||||||
use App\Models\User;
|
|
||||||
use App\Models\TenantPackage;
|
use App\Models\TenantPackage;
|
||||||
|
use App\Models\User;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
use Illuminate\Support\Facades\Hash;
|
use Illuminate\Support\Facades\Hash;
|
||||||
use Illuminate\Support\Facades\DB;
|
|
||||||
|
|
||||||
class MigrateLegacyPurchases extends Command
|
class MigrateLegacyPurchases extends Command
|
||||||
{
|
{
|
||||||
protected $signature = 'packages:migrate-legacy';
|
protected $signature = 'packages:migrate-legacy';
|
||||||
|
|
||||||
protected $description = 'Migrate legacy purchases to new system with temp tenants';
|
protected $description = 'Migrate legacy purchases to new system with temp tenants';
|
||||||
|
|
||||||
public function handle()
|
public function handle()
|
||||||
@@ -21,19 +21,20 @@ class MigrateLegacyPurchases extends Command
|
|||||||
|
|
||||||
if ($legacyPurchases->isEmpty()) {
|
if ($legacyPurchases->isEmpty()) {
|
||||||
$this->info('No legacy purchases found.');
|
$this->info('No legacy purchases found.');
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->info("Found {$legacyPurchases->count()} legacy purchases.");
|
$this->info("Found {$legacyPurchases->count()} legacy purchases.");
|
||||||
|
|
||||||
foreach ($legacyPurchases as $purchase) {
|
foreach ($legacyPurchases as $purchase) {
|
||||||
if (!$purchase->user_id) {
|
if (! $purchase->user_id) {
|
||||||
// Create temp user if no user
|
// Create temp user if no user
|
||||||
$tempUser = User::create([
|
$tempUser = User::create([
|
||||||
'name' => 'Legacy User ' . $purchase->id,
|
'name' => 'Legacy User '.$purchase->id,
|
||||||
'email' => 'legacy' . $purchase->id . '@fotospiel.local',
|
'email' => 'legacy'.$purchase->id.'@fotospiel.local',
|
||||||
'password' => Hash::make('legacy'),
|
'password' => Hash::make('legacy'),
|
||||||
'username' => 'legacy' . $purchase->id,
|
'username' => 'legacy'.$purchase->id,
|
||||||
'first_name' => 'Legacy',
|
'first_name' => 'Legacy',
|
||||||
'last_name' => 'User',
|
'last_name' => 'User',
|
||||||
'address' => 'Legacy Address',
|
'address' => 'Legacy Address',
|
||||||
@@ -43,7 +44,7 @@ class MigrateLegacyPurchases extends Command
|
|||||||
|
|
||||||
$tempTenant = Tenant::create([
|
$tempTenant = Tenant::create([
|
||||||
'user_id' => $tempUser->id,
|
'user_id' => $tempUser->id,
|
||||||
'name' => 'Legacy Tenant ' . $purchase->id,
|
'name' => 'Legacy Tenant '.$purchase->id,
|
||||||
'status' => 'active',
|
'status' => 'active',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@@ -73,6 +74,7 @@ class MigrateLegacyPurchases extends Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->info('Legacy migration completed.');
|
$this->info('Legacy migration completed.');
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -26,7 +26,7 @@ class SeedDemoSwitcherTenants extends Command
|
|||||||
{
|
{
|
||||||
protected $signature = 'demo:seed-switcher {--with-photos : Download sample photos from Pexels} {--photos-per-event=18 : Target photos per event when downloading} {--cleanup : Remove demo switcher tenants/events/photos instead of seeding}';
|
protected $signature = 'demo:seed-switcher {--with-photos : Download sample photos from Pexels} {--photos-per-event=18 : Target photos per event when downloading} {--cleanup : Remove demo switcher tenants/events/photos instead of seeding}';
|
||||||
|
|
||||||
protected $description = 'Seeds demo tenants used by the DevTenantSwitcher (endcustomer + reseller profiles)';
|
protected $description = 'Seeds demo tenants used by the DevTenantSwitcher (endcustomer + partner profiles)';
|
||||||
|
|
||||||
public function __construct(private EventStorageManager $eventStorageManager)
|
public function __construct(private EventStorageManager $eventStorageManager)
|
||||||
{
|
{
|
||||||
@@ -52,7 +52,7 @@ class SeedDemoSwitcherTenants extends Command
|
|||||||
|
|
||||||
DB::transaction(function () use ($packages, $eventTypes) {
|
DB::transaction(function () use ($packages, $eventTypes) {
|
||||||
$this->seedCustomerStandardEmpty($packages, $eventTypes);
|
$this->seedCustomerStandardEmpty($packages, $eventTypes);
|
||||||
$this->seedCustomerStarterWedding($packages, $eventTypes);
|
$this->seedCustomerStandardWedding($packages, $eventTypes);
|
||||||
$this->seedResellerActive($packages, $eventTypes);
|
$this->seedResellerActive($packages, $eventTypes);
|
||||||
$this->seedResellerFull($packages, $eventTypes);
|
$this->seedResellerFull($packages, $eventTypes);
|
||||||
});
|
});
|
||||||
@@ -129,7 +129,7 @@ class SeedDemoSwitcherTenants extends Command
|
|||||||
$slugs = [
|
$slugs = [
|
||||||
'starter' => 'Starter',
|
'starter' => 'Starter',
|
||||||
'standard' => 'Standard',
|
'standard' => 'Standard',
|
||||||
's-small-reseller' => 'Reseller S',
|
's-small-reseller' => 'Partner Start',
|
||||||
];
|
];
|
||||||
|
|
||||||
$packages = [];
|
$packages = [];
|
||||||
@@ -165,10 +165,10 @@ class SeedDemoSwitcherTenants extends Command
|
|||||||
{
|
{
|
||||||
$tenant = $this->upsertTenant(
|
$tenant = $this->upsertTenant(
|
||||||
slug: 'demo-standard-empty',
|
slug: 'demo-standard-empty',
|
||||||
name: 'Demo Standard (ohne Event)',
|
name: 'Demo Starter (ohne Event)',
|
||||||
contactEmail: 'standard-empty@demo.fotospiel',
|
contactEmail: 'standard-empty@demo.fotospiel',
|
||||||
attributes: [
|
attributes: [
|
||||||
'subscription_tier' => 'standard',
|
'subscription_tier' => 'starter',
|
||||||
'subscription_status' => 'active',
|
'subscription_status' => 'active',
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@@ -176,9 +176,9 @@ class SeedDemoSwitcherTenants extends Command
|
|||||||
$this->upsertAdmin($tenant, 'standard-empty@demo.fotospiel');
|
$this->upsertAdmin($tenant, 'standard-empty@demo.fotospiel');
|
||||||
|
|
||||||
TenantPackage::updateOrCreate(
|
TenantPackage::updateOrCreate(
|
||||||
['tenant_id' => $tenant->id, 'package_id' => $packages['standard']->id],
|
['tenant_id' => $tenant->id, 'package_id' => $packages['starter']->id],
|
||||||
[
|
[
|
||||||
'price' => $packages['standard']->price,
|
'price' => $packages['starter']->price,
|
||||||
'purchased_at' => Carbon::now()->subDays(1),
|
'purchased_at' => Carbon::now()->subDays(1),
|
||||||
'expires_at' => Carbon::now()->addMonths(12),
|
'expires_at' => Carbon::now()->addMonths(12),
|
||||||
'used_events' => 0,
|
'used_events' => 0,
|
||||||
@@ -186,17 +186,17 @@ class SeedDemoSwitcherTenants extends Command
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->comment('Seeded Standard tenant without events.');
|
$this->comment('Seeded Starter tenant without events.');
|
||||||
}
|
}
|
||||||
|
|
||||||
private function seedCustomerStarterWedding(array $packages, array $eventTypes): void
|
private function seedCustomerStandardWedding(array $packages, array $eventTypes): void
|
||||||
{
|
{
|
||||||
$tenant = $this->upsertTenant(
|
$tenant = $this->upsertTenant(
|
||||||
slug: 'demo-starter-wedding',
|
slug: 'demo-starter-wedding',
|
||||||
name: 'Demo Starter Wedding',
|
name: 'Demo Standard Wedding',
|
||||||
contactEmail: 'starter-wedding@demo.fotospiel',
|
contactEmail: 'starter-wedding@demo.fotospiel',
|
||||||
attributes: [
|
attributes: [
|
||||||
'subscription_tier' => 'starter',
|
'subscription_tier' => 'standard',
|
||||||
'subscription_status' => 'active',
|
'subscription_status' => 'active',
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@@ -209,7 +209,7 @@ class SeedDemoSwitcherTenants extends Command
|
|||||||
'price' => $packages['standard']->price,
|
'price' => $packages['standard']->price,
|
||||||
'purchased_at' => Carbon::now()->subDays(1),
|
'purchased_at' => Carbon::now()->subDays(1),
|
||||||
'expires_at' => Carbon::now()->addMonths(12),
|
'expires_at' => Carbon::now()->addMonths(12),
|
||||||
'used_events' => 0,
|
'used_events' => 1,
|
||||||
'active' => true,
|
'active' => true,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
@@ -232,17 +232,18 @@ class SeedDemoSwitcherTenants extends Command
|
|||||||
|
|
||||||
private function seedResellerActive(array $packages, array $eventTypes): void
|
private function seedResellerActive(array $packages, array $eventTypes): void
|
||||||
{
|
{
|
||||||
|
$eventPackage = $this->resolveIncludedPackage($packages['s-small-reseller'], $packages);
|
||||||
$tenant = $this->upsertTenant(
|
$tenant = $this->upsertTenant(
|
||||||
slug: 'demo-reseller-active',
|
slug: 'demo-reseller-active',
|
||||||
name: 'Demo Reseller Active',
|
name: 'Demo Partner Active',
|
||||||
contactEmail: 'reseller-active@demo.fotospiel',
|
contactEmail: 'partner-active@demo.fotospiel',
|
||||||
attributes: [
|
attributes: [
|
||||||
'subscription_tier' => 'reseller',
|
'subscription_tier' => 'reseller',
|
||||||
'subscription_status' => 'active',
|
'subscription_status' => 'active',
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->upsertAdmin($tenant, 'reseller-active@demo.fotospiel');
|
$this->upsertAdmin($tenant, 'partner-active@demo.fotospiel');
|
||||||
|
|
||||||
TenantPackage::updateOrCreate(
|
TenantPackage::updateOrCreate(
|
||||||
['tenant_id' => $tenant->id, 'package_id' => $packages['s-small-reseller']->id],
|
['tenant_id' => $tenant->id, 'package_id' => $packages['s-small-reseller']->id],
|
||||||
@@ -279,7 +280,7 @@ class SeedDemoSwitcherTenants extends Command
|
|||||||
foreach ($events as $index => $config) {
|
foreach ($events as $index => $config) {
|
||||||
$event = $this->upsertEvent(
|
$event = $this->upsertEvent(
|
||||||
tenant: $tenant,
|
tenant: $tenant,
|
||||||
package: $packages['standard'],
|
package: $eventPackage,
|
||||||
eventType: $config['type'],
|
eventType: $config['type'],
|
||||||
attributes: [
|
attributes: [
|
||||||
'name' => $config['name'],
|
'name' => $config['name'],
|
||||||
@@ -296,17 +297,18 @@ class SeedDemoSwitcherTenants extends Command
|
|||||||
|
|
||||||
private function seedResellerFull(array $packages, array $eventTypes): void
|
private function seedResellerFull(array $packages, array $eventTypes): void
|
||||||
{
|
{
|
||||||
|
$eventPackage = $this->resolveIncludedPackage($packages['s-small-reseller'], $packages);
|
||||||
$tenant = $this->upsertTenant(
|
$tenant = $this->upsertTenant(
|
||||||
slug: 'demo-reseller-full',
|
slug: 'demo-reseller-full',
|
||||||
name: 'Demo Reseller Voll',
|
name: 'Demo Partner Voll',
|
||||||
contactEmail: 'reseller-full@demo.fotospiel',
|
contactEmail: 'partner-full@demo.fotospiel',
|
||||||
attributes: [
|
attributes: [
|
||||||
'subscription_tier' => 'reseller',
|
'subscription_tier' => 'reseller',
|
||||||
'subscription_status' => 'active',
|
'subscription_status' => 'active',
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->upsertAdmin($tenant, 'reseller-full@demo.fotospiel');
|
$this->upsertAdmin($tenant, 'partner-full@demo.fotospiel');
|
||||||
|
|
||||||
TenantPackage::updateOrCreate(
|
TenantPackage::updateOrCreate(
|
||||||
['tenant_id' => $tenant->id, 'package_id' => $packages['s-small-reseller']->id],
|
['tenant_id' => $tenant->id, 'package_id' => $packages['s-small-reseller']->id],
|
||||||
@@ -330,7 +332,7 @@ class SeedDemoSwitcherTenants extends Command
|
|||||||
foreach ($eventConfigs as $index => $config) {
|
foreach ($eventConfigs as $index => $config) {
|
||||||
$event = $this->upsertEvent(
|
$event = $this->upsertEvent(
|
||||||
tenant: $tenant,
|
tenant: $tenant,
|
||||||
package: $packages['standard'],
|
package: $eventPackage,
|
||||||
eventType: $config['type'],
|
eventType: $config['type'],
|
||||||
attributes: [
|
attributes: [
|
||||||
'name' => $config['name'],
|
'name' => $config['name'],
|
||||||
@@ -357,8 +359,8 @@ class SeedDemoSwitcherTenants extends Command
|
|||||||
'settings' => [
|
'settings' => [
|
||||||
'branding' => [
|
'branding' => [
|
||||||
'logo_url' => null,
|
'logo_url' => null,
|
||||||
'primary_color' => '#1D4ED8',
|
'primary_color' => '#FF5A5F',
|
||||||
'secondary_color' => '#0F172A',
|
'secondary_color' => '#FFF8F5',
|
||||||
'font_family' => 'Inter, sans-serif',
|
'font_family' => 'Inter, sans-serif',
|
||||||
],
|
],
|
||||||
'features' => [
|
'features' => [
|
||||||
@@ -435,6 +437,19 @@ class SeedDemoSwitcherTenants extends Command
|
|||||||
return $event;
|
return $event;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function resolveIncludedPackage(Package $resellerPackage, array $packages): Package
|
||||||
|
{
|
||||||
|
$includedSlug = $resellerPackage->included_package_slug;
|
||||||
|
|
||||||
|
if ($includedSlug && isset($packages[$includedSlug])) {
|
||||||
|
return $packages[$includedSlug];
|
||||||
|
}
|
||||||
|
|
||||||
|
$fallback = $packages['starter'] ?? $packages['standard'] ?? null;
|
||||||
|
|
||||||
|
return $fallback ?? $resellerPackage;
|
||||||
|
}
|
||||||
|
|
||||||
private function fallbackEventType(): ?EventType
|
private function fallbackEventType(): ?EventType
|
||||||
{
|
{
|
||||||
$fallback = EventType::first();
|
$fallback = EventType::first();
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ class SendAbandonedCheckoutReminders extends Command
|
|||||||
if ($this->shouldSendReminder($checkout, $stage)) {
|
if ($this->shouldSendReminder($checkout, $stage)) {
|
||||||
$resumeUrl = $this->generateResumeUrl($checkout);
|
$resumeUrl = $this->generateResumeUrl($checkout);
|
||||||
|
|
||||||
if (!$isDryRun) {
|
if (! $isDryRun) {
|
||||||
$mailLocale = $checkout->user->preferred_locale ?? config('app.locale');
|
$mailLocale = $checkout->user->preferred_locale ?? config('app.locale');
|
||||||
|
|
||||||
Mail::to($checkout->user)
|
Mail::to($checkout->user)
|
||||||
@@ -86,8 +86,8 @@ class SendAbandonedCheckoutReminders extends Command
|
|||||||
$totalProcessed++;
|
$totalProcessed++;
|
||||||
}
|
}
|
||||||
} catch (Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
Log::error("Failed to send {$stage} reminder for checkout {$checkout->id}: " . $e->getMessage());
|
Log::error("Failed to send {$stage} reminder for checkout {$checkout->id}: ".$e->getMessage());
|
||||||
$this->error(" ❌ Failed to process checkout {$checkout->id}: " . $e->getMessage());
|
$this->error(" ❌ Failed to process checkout {$checkout->id}: ".$e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -98,7 +98,7 @@ class SendAbandonedCheckoutReminders extends Command
|
|||||||
->count();
|
->count();
|
||||||
|
|
||||||
if ($oldCheckouts > 0) {
|
if ($oldCheckouts > 0) {
|
||||||
if (!$isDryRun) {
|
if (! $isDryRun) {
|
||||||
AbandonedCheckoutModel::where('abandoned_at', '<', now()->subDays(30))
|
AbandonedCheckoutModel::where('abandoned_at', '<', now()->subDays(30))
|
||||||
->where('converted', false)
|
->where('converted', false)
|
||||||
->delete();
|
->delete();
|
||||||
@@ -108,10 +108,10 @@ class SendAbandonedCheckoutReminders extends Command
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->info("✅ Reminder process completed!");
|
$this->info('✅ Reminder process completed!');
|
||||||
$this->info(" Processed: {$totalProcessed} checkouts");
|
$this->info(" Processed: {$totalProcessed} checkouts");
|
||||||
|
|
||||||
if (!$isDryRun) {
|
if (! $isDryRun) {
|
||||||
$this->info(" Sent: {$totalSent} reminder emails");
|
$this->info(" Sent: {$totalSent} reminder emails");
|
||||||
} else {
|
} else {
|
||||||
$this->info(" Would send: {$totalSent} reminder emails");
|
$this->info(" Would send: {$totalSent} reminder emails");
|
||||||
@@ -131,12 +131,12 @@ class SendAbandonedCheckoutReminders extends Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
// User existiert noch?
|
// User existiert noch?
|
||||||
if (!$checkout->user) {
|
if (! $checkout->user) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Package existiert noch?
|
// Package existiert noch?
|
||||||
if (!$checkout->package) {
|
if (! $checkout->package) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,8 +5,6 @@ namespace App\Exports;
|
|||||||
use App\Models\EventPurchase;
|
use App\Models\EventPurchase;
|
||||||
use Filament\Actions\Exports\Exporter;
|
use Filament\Actions\Exports\Exporter;
|
||||||
use Filament\Actions\Exports\Models\Export;
|
use Filament\Actions\Exports\Models\Export;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
|
||||||
use Illuminate\Support\Collection;
|
|
||||||
|
|
||||||
class EventPurchaseExporter extends Exporter
|
class EventPurchaseExporter extends Exporter
|
||||||
{
|
{
|
||||||
@@ -28,7 +26,6 @@ class EventPurchaseExporter extends Exporter
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static function getCompletedNotificationBody(Export $export): string
|
public static function getCompletedNotificationBody(Export $export): string
|
||||||
{
|
{
|
||||||
$body = "Your Event Purchases export has completed and is ready for download. {$export->successful_rows} purchases were exported.";
|
$body = "Your Event Purchases export has completed and is ready for download. {$export->successful_rows} purchases were exported.";
|
||||||
|
|||||||
@@ -79,9 +79,10 @@ class PostResource extends Resource
|
|||||||
->label('Inhalt')
|
->label('Inhalt')
|
||||||
->required()
|
->required()
|
||||||
->columnSpanFull(),
|
->columnSpanFull(),
|
||||||
TextInput::make('excerpt.de')
|
Textarea::make('excerpt.de')
|
||||||
->label('Auszug')
|
->label('Auszug')
|
||||||
->maxLength(255),
|
->maxLength(65535)
|
||||||
|
->columnSpanFull(),
|
||||||
TextInput::make('meta_title.de')
|
TextInput::make('meta_title.de')
|
||||||
->label('Meta-Titel')
|
->label('Meta-Titel')
|
||||||
->maxLength(255),
|
->maxLength(255),
|
||||||
@@ -99,9 +100,10 @@ class PostResource extends Resource
|
|||||||
MarkdownEditor::make('content.en')
|
MarkdownEditor::make('content.en')
|
||||||
->label('Inhalt')
|
->label('Inhalt')
|
||||||
->columnSpanFull(),
|
->columnSpanFull(),
|
||||||
TextInput::make('excerpt.en')
|
Textarea::make('excerpt.en')
|
||||||
->label('Auszug')
|
->label('Auszug')
|
||||||
->maxLength(255),
|
->maxLength(65535)
|
||||||
|
->columnSpanFull(),
|
||||||
TextInput::make('meta_title.en')
|
TextInput::make('meta_title.en')
|
||||||
->label('Meta-Titel')
|
->label('Meta-Titel')
|
||||||
->maxLength(255),
|
->maxLength(255),
|
||||||
@@ -121,9 +123,10 @@ class PostResource extends Resource
|
|||||||
->unique(BlogPost::class, 'slug', ignoreRecord: true)
|
->unique(BlogPost::class, 'slug', ignoreRecord: true)
|
||||||
->maxLength(255)
|
->maxLength(255)
|
||||||
->columnSpanFull(),
|
->columnSpanFull(),
|
||||||
FileUpload::make('featured_image')
|
FileUpload::make('banner')
|
||||||
->label('Featured Image')
|
->label('Featured Image')
|
||||||
->image()
|
->image()
|
||||||
|
->disk('public')
|
||||||
->directory('blog')
|
->directory('blog')
|
||||||
->visibility('public'),
|
->visibility('public'),
|
||||||
Select::make('blog_category_id')
|
Select::make('blog_category_id')
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Clusters\WeeklyOps\Resources\TaskCollections\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Clusters\WeeklyOps\Resources\TaskCollections\TaskCollectionResource;
|
||||||
|
use App\Filament\Resources\Pages\AuditedCreateRecord;
|
||||||
|
|
||||||
|
class CreateTaskCollection extends AuditedCreateRecord
|
||||||
|
{
|
||||||
|
protected static string $resource = TaskCollectionResource::class;
|
||||||
|
|
||||||
|
protected function mutateFormDataBeforeCreate(array $data): array
|
||||||
|
{
|
||||||
|
return TaskCollectionResource::normalizeData($data);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Clusters\WeeklyOps\Resources\TaskCollections\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Clusters\WeeklyOps\Resources\TaskCollections\TaskCollectionResource;
|
||||||
|
use App\Filament\Resources\Pages\AuditedEditRecord;
|
||||||
|
use App\Services\Audit\SuperAdminAuditLogger;
|
||||||
|
use Filament\Actions;
|
||||||
|
|
||||||
|
class EditTaskCollection extends AuditedEditRecord
|
||||||
|
{
|
||||||
|
protected static string $resource = TaskCollectionResource::class;
|
||||||
|
|
||||||
|
protected function getHeaderActions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
Actions\DeleteAction::make()
|
||||||
|
->after(fn ($record) => app(SuperAdminAuditLogger::class)->recordModelMutation(
|
||||||
|
'deleted',
|
||||||
|
$record,
|
||||||
|
source: static::class
|
||||||
|
)),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function mutateFormDataBeforeSave(array $data): array
|
||||||
|
{
|
||||||
|
return TaskCollectionResource::normalizeData($data, $this->record);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Clusters\WeeklyOps\Resources\TaskCollections\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Clusters\WeeklyOps\Resources\TaskCollections\TaskCollectionResource;
|
||||||
|
use Filament\Actions;
|
||||||
|
use Filament\Resources\Pages\ListRecords;
|
||||||
|
|
||||||
|
class ListTaskCollections extends ListRecords
|
||||||
|
{
|
||||||
|
protected static string $resource = TaskCollectionResource::class;
|
||||||
|
|
||||||
|
protected function getHeaderActions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
Actions\CreateAction::make(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,127 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Clusters\WeeklyOps\Resources\TaskCollections\RelationManagers;
|
||||||
|
|
||||||
|
use App\Models\Task;
|
||||||
|
use Filament\Actions\AttachAction;
|
||||||
|
use Filament\Actions\BulkActionGroup;
|
||||||
|
use Filament\Actions\DetachAction;
|
||||||
|
use Filament\Actions\DetachBulkAction;
|
||||||
|
use Filament\Resources\RelationManagers\RelationManager;
|
||||||
|
use Filament\Tables\Columns\IconColumn;
|
||||||
|
use Filament\Tables\Columns\TextColumn;
|
||||||
|
use Filament\Tables\Table;
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Database\Eloquent\Collection;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
|
|
||||||
|
class TasksRelationManager extends RelationManager
|
||||||
|
{
|
||||||
|
protected static string $relationship = 'tasks';
|
||||||
|
|
||||||
|
protected static ?string $inverseRelationship = 'taskCollections';
|
||||||
|
|
||||||
|
public function table(Table $table): Table
|
||||||
|
{
|
||||||
|
return $table
|
||||||
|
->columns([
|
||||||
|
TextColumn::make('title')
|
||||||
|
->label(__('admin.tasks.table.title'))
|
||||||
|
->getStateUsing(fn (Task $record) => $this->formatTaskTitle($record->title))
|
||||||
|
->searchable(['title->de', 'title->en'])
|
||||||
|
->limit(60),
|
||||||
|
TextColumn::make('emotion.name')
|
||||||
|
->label(__('admin.tasks.fields.emotion'))
|
||||||
|
->getStateUsing(function (Task $record) {
|
||||||
|
$value = optional($record->emotion)->name;
|
||||||
|
if (is_array($value)) {
|
||||||
|
$locale = app()->getLocale();
|
||||||
|
|
||||||
|
return $value[$locale] ?? ($value['de'] ?? ($value['en'] ?? ''));
|
||||||
|
}
|
||||||
|
|
||||||
|
return (string) ($value ?? '');
|
||||||
|
})
|
||||||
|
->sortable(),
|
||||||
|
TextColumn::make('difficulty')
|
||||||
|
->label(__('admin.tasks.fields.difficulty.label'))
|
||||||
|
->badge(),
|
||||||
|
IconColumn::make('is_active')
|
||||||
|
->label(__('admin.tasks.table.is_active'))
|
||||||
|
->boolean(),
|
||||||
|
TextColumn::make('sort_order')
|
||||||
|
->label(__('admin.tasks.table.sort_order'))
|
||||||
|
->sortable(),
|
||||||
|
])
|
||||||
|
->headerActions([
|
||||||
|
AttachAction::make()
|
||||||
|
->recordTitle(fn (Task $record) => $this->formatTaskTitle($record->title))
|
||||||
|
->recordSelectOptionsQuery(fn (Builder $query): Builder => $query->whereNull('tenant_id'))
|
||||||
|
->multiple()
|
||||||
|
->after(function (array $data): void {
|
||||||
|
$collection = $this->getOwnerRecord();
|
||||||
|
$recordIds = Arr::wrap($data['recordId'] ?? []);
|
||||||
|
|
||||||
|
if ($recordIds === []) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$collection->reassignTasks($recordIds);
|
||||||
|
}),
|
||||||
|
])
|
||||||
|
->recordActions([
|
||||||
|
DetachAction::make()
|
||||||
|
->after(function (?Task $record): void {
|
||||||
|
if (! $record) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$collectionId = $this->getOwnerRecord()->getKey();
|
||||||
|
|
||||||
|
if ($record->collection_id === $collectionId) {
|
||||||
|
$record->update(['collection_id' => null]);
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
])
|
||||||
|
->toolbarActions([
|
||||||
|
BulkActionGroup::make([
|
||||||
|
DetachBulkAction::make()
|
||||||
|
->after(function (Collection $records): void {
|
||||||
|
$collectionId = $this->getOwnerRecord()->getKey();
|
||||||
|
|
||||||
|
$ids = $records
|
||||||
|
->filter(fn (Task $record) => $record->collection_id === $collectionId)
|
||||||
|
->pluck('id')
|
||||||
|
->all();
|
||||||
|
|
||||||
|
if ($ids === []) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Task::query()
|
||||||
|
->whereIn('id', $ids)
|
||||||
|
->update(['collection_id' => null]);
|
||||||
|
}),
|
||||||
|
]),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<string, string>|string|null $value
|
||||||
|
*/
|
||||||
|
protected function formatTaskTitle(array|string|null $value): string
|
||||||
|
{
|
||||||
|
if (is_array($value)) {
|
||||||
|
$locale = app()->getLocale();
|
||||||
|
|
||||||
|
return $value[$locale]
|
||||||
|
?? ($value['de'] ?? ($value['en'] ?? Arr::first($value) ?? ''));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_string($value)) {
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,280 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Clusters\WeeklyOps\Resources\TaskCollections;
|
||||||
|
|
||||||
|
use App\Filament\Clusters\WeeklyOps\Resources\TaskCollections\Pages\CreateTaskCollection;
|
||||||
|
use App\Filament\Clusters\WeeklyOps\Resources\TaskCollections\Pages\EditTaskCollection;
|
||||||
|
use App\Filament\Clusters\WeeklyOps\Resources\TaskCollections\Pages\ListTaskCollections;
|
||||||
|
use App\Filament\Clusters\WeeklyOps\Resources\TaskCollections\RelationManagers\TasksRelationManager;
|
||||||
|
use App\Filament\Clusters\WeeklyOps\WeeklyOpsCluster;
|
||||||
|
use App\Models\EventType;
|
||||||
|
use App\Models\TaskCollection;
|
||||||
|
use App\Services\Audit\SuperAdminAuditLogger;
|
||||||
|
use BackedEnum;
|
||||||
|
use Filament\Actions;
|
||||||
|
use Filament\Forms\Components\MarkdownEditor;
|
||||||
|
use Filament\Forms\Components\Select;
|
||||||
|
use Filament\Forms\Components\TextInput;
|
||||||
|
use Filament\Forms\Components\Toggle;
|
||||||
|
use Filament\Resources\Resource;
|
||||||
|
use Filament\Schemas\Components\Tabs as SchemaTabs;
|
||||||
|
use Filament\Schemas\Components\Tabs\Tab as SchemaTab;
|
||||||
|
use Filament\Schemas\Schema;
|
||||||
|
use Filament\Tables\Columns\IconColumn;
|
||||||
|
use Filament\Tables\Columns\TextColumn;
|
||||||
|
use Filament\Tables\Filters\SelectFilter;
|
||||||
|
use Filament\Tables\Table;
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Database\Eloquent\Collection;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
use UnitEnum;
|
||||||
|
|
||||||
|
class TaskCollectionResource extends Resource
|
||||||
|
{
|
||||||
|
protected static ?string $model = TaskCollection::class;
|
||||||
|
|
||||||
|
protected static BackedEnum|string|null $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||||
|
|
||||||
|
protected static ?string $cluster = WeeklyOpsCluster::class;
|
||||||
|
|
||||||
|
protected static ?string $recordTitleAttribute = 'name';
|
||||||
|
|
||||||
|
protected static ?int $navigationSort = 31;
|
||||||
|
|
||||||
|
public static function form(Schema $schema): Schema
|
||||||
|
{
|
||||||
|
return $schema
|
||||||
|
->schema([
|
||||||
|
TextInput::make('slug')
|
||||||
|
->label(__('admin.common.slug'))
|
||||||
|
->maxLength(255)
|
||||||
|
->unique(ignoreRecord: true)
|
||||||
|
->required(),
|
||||||
|
Select::make('event_type_id')
|
||||||
|
->relationship('eventType', 'name')
|
||||||
|
->getOptionLabelFromRecordUsing(fn (EventType $record) => is_array($record->name) ? ($record->name['de'] ?? $record->name['en'] ?? __('admin.common.unnamed')) : $record->name)
|
||||||
|
->searchable()
|
||||||
|
->preload()
|
||||||
|
->label(__('admin.task_collections.fields.event_type_optional')),
|
||||||
|
SchemaTabs::make('content_tabs')
|
||||||
|
->label(__('admin.task_collections.fields.content_localization'))
|
||||||
|
->tabs([
|
||||||
|
SchemaTab::make(__('admin.common.german'))
|
||||||
|
->icon('heroicon-o-language')
|
||||||
|
->schema([
|
||||||
|
TextInput::make('name_translations.de')
|
||||||
|
->label(__('admin.task_collections.fields.name_de'))
|
||||||
|
->required(),
|
||||||
|
MarkdownEditor::make('description_translations.de')
|
||||||
|
->label(__('admin.task_collections.fields.description_de'))
|
||||||
|
->columnSpanFull(),
|
||||||
|
]),
|
||||||
|
SchemaTab::make(__('admin.common.english'))
|
||||||
|
->icon('heroicon-o-language')
|
||||||
|
->schema([
|
||||||
|
TextInput::make('name_translations.en')
|
||||||
|
->label(__('admin.task_collections.fields.name_en'))
|
||||||
|
->required(),
|
||||||
|
MarkdownEditor::make('description_translations.en')
|
||||||
|
->label(__('admin.task_collections.fields.description_en'))
|
||||||
|
->columnSpanFull(),
|
||||||
|
]),
|
||||||
|
])
|
||||||
|
->columnSpanFull(),
|
||||||
|
Toggle::make('is_default')
|
||||||
|
->label(__('admin.task_collections.fields.is_default'))
|
||||||
|
->default(false),
|
||||||
|
TextInput::make('position')
|
||||||
|
->label(__('admin.task_collections.fields.position'))
|
||||||
|
->numeric()
|
||||||
|
->default(0),
|
||||||
|
])
|
||||||
|
->columns(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function table(Table $table): Table
|
||||||
|
{
|
||||||
|
return $table
|
||||||
|
->columns([
|
||||||
|
TextColumn::make('id')
|
||||||
|
->label('#')
|
||||||
|
->sortable(),
|
||||||
|
TextColumn::make('name')
|
||||||
|
->label(__('admin.task_collections.table.name'))
|
||||||
|
->getStateUsing(fn (TaskCollection $record) => static::formatTranslation($record->name_translations))
|
||||||
|
->searchable(['name_translations->de', 'name_translations->en'])
|
||||||
|
->limit(60),
|
||||||
|
TextColumn::make('eventType.name')
|
||||||
|
->label(__('admin.task_collections.table.event_type'))
|
||||||
|
->getStateUsing(function (TaskCollection $record) {
|
||||||
|
$value = optional($record->eventType)->name;
|
||||||
|
|
||||||
|
if (is_array($value)) {
|
||||||
|
$locale = app()->getLocale();
|
||||||
|
|
||||||
|
return $value[$locale] ?? ($value['de'] ?? ($value['en'] ?? ''));
|
||||||
|
}
|
||||||
|
|
||||||
|
return (string) ($value ?? '');
|
||||||
|
})
|
||||||
|
->toggleable(),
|
||||||
|
TextColumn::make('slug')
|
||||||
|
->label(__('admin.task_collections.table.slug'))
|
||||||
|
->toggleable()
|
||||||
|
->searchable(),
|
||||||
|
IconColumn::make('is_default')
|
||||||
|
->label(__('admin.task_collections.table.is_default'))
|
||||||
|
->boolean(),
|
||||||
|
TextColumn::make('position')
|
||||||
|
->label(__('admin.task_collections.table.position'))
|
||||||
|
->sortable(),
|
||||||
|
TextColumn::make('tasks_count')
|
||||||
|
->label(__('admin.task_collections.table.tasks'))
|
||||||
|
->sortable(),
|
||||||
|
TextColumn::make('events_count')
|
||||||
|
->label(__('admin.task_collections.table.events'))
|
||||||
|
->sortable(),
|
||||||
|
])
|
||||||
|
->filters([
|
||||||
|
SelectFilter::make('event_type_id')
|
||||||
|
->label(__('admin.task_collections.table.event_type'))
|
||||||
|
->relationship(
|
||||||
|
'eventType',
|
||||||
|
'name',
|
||||||
|
fn (Builder $query): Builder => $query->orderBy('name->de')
|
||||||
|
)
|
||||||
|
->getOptionLabelFromRecordUsing(fn (EventType $record) => is_array($record->name) ? ($record->name['de'] ?? $record->name['en'] ?? __('admin.common.unnamed')) : $record->name),
|
||||||
|
SelectFilter::make('is_default')
|
||||||
|
->label(__('admin.task_collections.table.is_default'))
|
||||||
|
->options([
|
||||||
|
'1' => __('admin.common.yes'),
|
||||||
|
'0' => __('admin.common.no'),
|
||||||
|
]),
|
||||||
|
])
|
||||||
|
->recordActions([
|
||||||
|
Actions\EditAction::make()
|
||||||
|
->mutateDataUsing(fn (array $data, TaskCollection $record): array => static::normalizeData($data, $record))
|
||||||
|
->after(fn (array $data, TaskCollection $record) => app(SuperAdminAuditLogger::class)->recordModelMutation(
|
||||||
|
'updated',
|
||||||
|
$record,
|
||||||
|
SuperAdminAuditLogger::fieldsMetadata($data),
|
||||||
|
static::class
|
||||||
|
)),
|
||||||
|
Actions\DeleteAction::make()
|
||||||
|
->after(fn (TaskCollection $record) => app(SuperAdminAuditLogger::class)->recordModelMutation(
|
||||||
|
'deleted',
|
||||||
|
$record,
|
||||||
|
source: static::class
|
||||||
|
)),
|
||||||
|
])
|
||||||
|
->bulkActions([
|
||||||
|
Actions\DeleteBulkAction::make()
|
||||||
|
->after(function (Collection $records): void {
|
||||||
|
$logger = app(SuperAdminAuditLogger::class);
|
||||||
|
|
||||||
|
foreach ($records as $record) {
|
||||||
|
$logger->recordModelMutation(
|
||||||
|
'deleted',
|
||||||
|
$record,
|
||||||
|
source: static::class
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getNavigationLabel(): string
|
||||||
|
{
|
||||||
|
return __('admin.task_collections.menu');
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getNavigationGroup(): UnitEnum|string|null
|
||||||
|
{
|
||||||
|
return __('admin.nav.curation');
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getEloquentQuery(): Builder
|
||||||
|
{
|
||||||
|
return parent::getEloquentQuery()
|
||||||
|
->whereNull('tenant_id')
|
||||||
|
->with('eventType')
|
||||||
|
->withCount(['tasks', 'events']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<string, mixed> $data
|
||||||
|
*/
|
||||||
|
public static function normalizeData(array $data, ?TaskCollection $record = null): array
|
||||||
|
{
|
||||||
|
$data['tenant_id'] = null;
|
||||||
|
$data['slug'] = static::resolveSlug($data, $record);
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<string, mixed> $data
|
||||||
|
*/
|
||||||
|
protected static function resolveSlug(array $data, ?TaskCollection $record = null): string
|
||||||
|
{
|
||||||
|
$rawSlug = trim((string) ($data['slug'] ?? ''));
|
||||||
|
$translations = Arr::wrap($data['name_translations'] ?? []);
|
||||||
|
$fallbackName = (string) ($translations['en'] ?? $translations['de'] ?? '');
|
||||||
|
|
||||||
|
$base = $rawSlug !== '' ? $rawSlug : $fallbackName;
|
||||||
|
$slugBase = Str::slug($base) ?: 'collection';
|
||||||
|
|
||||||
|
$query = TaskCollection::query()->where('slug', $slugBase);
|
||||||
|
|
||||||
|
if ($record) {
|
||||||
|
$query->whereKeyNot($record->getKey());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $query->exists()) {
|
||||||
|
return $slugBase;
|
||||||
|
}
|
||||||
|
|
||||||
|
do {
|
||||||
|
$candidate = $slugBase.'-'.Str::random(4);
|
||||||
|
$candidateQuery = TaskCollection::query()->where('slug', $candidate);
|
||||||
|
|
||||||
|
if ($record) {
|
||||||
|
$candidateQuery->whereKeyNot($record->getKey());
|
||||||
|
}
|
||||||
|
} while ($candidateQuery->exists());
|
||||||
|
|
||||||
|
return $candidate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<string, string>|null $translations
|
||||||
|
*/
|
||||||
|
protected static function formatTranslation(?array $translations): string
|
||||||
|
{
|
||||||
|
if (! is_array($translations)) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$locale = app()->getLocale();
|
||||||
|
|
||||||
|
return $translations[$locale]
|
||||||
|
?? ($translations['de'] ?? ($translations['en'] ?? Arr::first($translations) ?? ''));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getPages(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'index' => ListTaskCollections::route('/'),
|
||||||
|
'create' => CreateTaskCollection::route('/create'),
|
||||||
|
'edit' => EditTaskCollection::route('/{record}/edit'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getRelations(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
TasksRelationManager::class,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -13,7 +13,9 @@ use Illuminate\Support\Facades\Storage;
|
|||||||
class ImportEmotions extends Page
|
class ImportEmotions extends Page
|
||||||
{
|
{
|
||||||
protected static string $resource = EmotionResource::class;
|
protected static string $resource = EmotionResource::class;
|
||||||
|
|
||||||
protected string $view = 'filament.resources.emotion-resource.pages.import-emotions';
|
protected string $view = 'filament.resources.emotion-resource.pages.import-emotions';
|
||||||
|
|
||||||
protected ?string $heading = null;
|
protected ?string $heading = null;
|
||||||
|
|
||||||
public ?string $file = null;
|
public ?string $file = null;
|
||||||
@@ -36,6 +38,7 @@ class ImportEmotions extends Page
|
|||||||
$path = $this->form->getState()['file'] ?? null;
|
$path = $this->form->getState()['file'] ?? null;
|
||||||
if (! $path || ! Storage::disk('public')->exists($path)) {
|
if (! $path || ! Storage::disk('public')->exists($path)) {
|
||||||
Notification::make()->danger()->title(__('admin.notifications.file_not_found'))->send();
|
Notification::make()->danger()->title(__('admin.notifications.file_not_found'))->send();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -60,19 +60,32 @@ class EventResource extends Resource
|
|||||||
->required()
|
->required()
|
||||||
->unique(ignoreRecord: true)
|
->unique(ignoreRecord: true)
|
||||||
->maxLength(255),
|
->maxLength(255),
|
||||||
|
TextInput::make('join_link_display')
|
||||||
|
->label(__('admin.events.fields.join_link'))
|
||||||
|
->afterStateHydrated(function (TextInput $component, ?Event $record) {
|
||||||
|
if (! $record) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$token = $record->joinTokens()->latest()->first();
|
||||||
|
$component->state($token ? url('/e/'.$token->token) : '-');
|
||||||
|
})
|
||||||
|
->readOnly()
|
||||||
|
->dehydrated(false)
|
||||||
|
->visibleOn('edit'),
|
||||||
DatePicker::make('date')
|
DatePicker::make('date')
|
||||||
->label(__('admin.events.fields.date'))
|
->label(__('admin.events.fields.date'))
|
||||||
->required(),
|
->required(),
|
||||||
Select::make('event_type_id')
|
Select::make('event_type_id')
|
||||||
->label(__('admin.events.fields.type'))
|
->label(__('admin.events.fields.type'))
|
||||||
->options(EventType::query()->pluck('name', 'id'))
|
->options(fn () => EventType::all()->pluck('name.de', 'id'))
|
||||||
->searchable(),
|
->searchable(),
|
||||||
Select::make('package_id')
|
Select::make('package_id')
|
||||||
->label(__('admin.events.fields.package'))
|
->label(__('admin.events.fields.package'))
|
||||||
->options(\App\Models\Package::query()->where('type', 'endcustomer')->pluck('name', 'id'))
|
->options(\App\Models\Package::query()->where('type', 'endcustomer')->pluck('name', 'id'))
|
||||||
->searchable()
|
->searchable()
|
||||||
->preload()
|
->preload()
|
||||||
->required(),
|
->required()
|
||||||
|
->visibleOn('create'),
|
||||||
TextInput::make('default_locale')
|
TextInput::make('default_locale')
|
||||||
->label(__('admin.events.fields.default_locale'))
|
->label(__('admin.events.fields.default_locale'))
|
||||||
->default('de')
|
->default('de')
|
||||||
@@ -102,7 +115,6 @@ class EventResource extends Resource
|
|||||||
Tables\Columns\TextColumn::make('slug')->searchable(),
|
Tables\Columns\TextColumn::make('slug')->searchable(),
|
||||||
Tables\Columns\TextColumn::make('date')->date(),
|
Tables\Columns\TextColumn::make('date')->date(),
|
||||||
Tables\Columns\IconColumn::make('is_active')->boolean(),
|
Tables\Columns\IconColumn::make('is_active')->boolean(),
|
||||||
Tables\Columns\TextColumn::make('default_locale'),
|
|
||||||
Tables\Columns\TextColumn::make('eventPackage.package.name')
|
Tables\Columns\TextColumn::make('eventPackage.package.name')
|
||||||
->label(__('admin.events.table.package'))
|
->label(__('admin.events.table.package'))
|
||||||
->badge()
|
->badge()
|
||||||
@@ -115,22 +127,6 @@ class EventResource extends Resource
|
|||||||
->badge()
|
->badge()
|
||||||
->color(fn ($state) => $state < 1 ? 'danger' : 'success')
|
->color(fn ($state) => $state < 1 ? 'danger' : 'success')
|
||||||
->getStateUsing(fn ($record) => $record->eventPackage?->remaining_photos ?? 0),
|
->getStateUsing(fn ($record) => $record->eventPackage?->remaining_photos ?? 0),
|
||||||
Tables\Columns\TextColumn::make('primary_join_token')
|
|
||||||
->label(__('admin.events.table.join'))
|
|
||||||
->getStateUsing(function ($record) {
|
|
||||||
$token = $record->joinTokens()->latest()->first();
|
|
||||||
|
|
||||||
return $token ? url('/e/'.$token->token) : __('admin.events.table.no_join_tokens');
|
|
||||||
})
|
|
||||||
->description(function ($record) {
|
|
||||||
$total = $record->joinTokens()->count();
|
|
||||||
|
|
||||||
return $total > 0
|
|
||||||
? __('admin.events.table.join_tokens_total', ['count' => $total])
|
|
||||||
: __('admin.events.table.join_tokens_missing');
|
|
||||||
})
|
|
||||||
->copyable()
|
|
||||||
->copyMessage(__('admin.events.messages.join_link_copied')),
|
|
||||||
Tables\Columns\TextColumn::make('created_at')->since(),
|
Tables\Columns\TextColumn::make('created_at')->since(),
|
||||||
])
|
])
|
||||||
->filters([])
|
->filters([])
|
||||||
|
|||||||
@@ -8,4 +8,25 @@ use App\Filament\Resources\Pages\AuditedCreateRecord;
|
|||||||
class CreateEvent extends AuditedCreateRecord
|
class CreateEvent extends AuditedCreateRecord
|
||||||
{
|
{
|
||||||
protected static string $resource = EventResource::class;
|
protected static string $resource = EventResource::class;
|
||||||
|
|
||||||
|
public ?int $packageId = null;
|
||||||
|
|
||||||
|
protected function mutateFormDataBeforeCreate(array $data): array
|
||||||
|
{
|
||||||
|
$this->packageId = $data['package_id'] ?? null;
|
||||||
|
unset($data['package_id']);
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function afterCreate(): void
|
||||||
|
{
|
||||||
|
if ($this->packageId) {
|
||||||
|
$this->record->eventPackages()->create([
|
||||||
|
'package_id' => $this->packageId,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
parent::afterCreate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ use Filament\Tables\Table;
|
|||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Database\Eloquent\Collection;
|
use Illuminate\Database\Eloquent\Collection;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\Relation;
|
|
||||||
|
|
||||||
class EventPackagesRelationManager extends RelationManager
|
class EventPackagesRelationManager extends RelationManager
|
||||||
{
|
{
|
||||||
@@ -59,6 +58,7 @@ class EventPackagesRelationManager extends RelationManager
|
|||||||
public function table(Table $table): Table
|
public function table(Table $table): Table
|
||||||
{
|
{
|
||||||
return $table
|
return $table
|
||||||
|
->modifyQueryUsing(fn (Builder $query) => $query->with('package'))
|
||||||
->recordTitleAttribute('package.name')
|
->recordTitleAttribute('package.name')
|
||||||
->columns([
|
->columns([
|
||||||
TextColumn::make('package.name')
|
TextColumn::make('package.name')
|
||||||
@@ -147,9 +147,4 @@ class EventPackagesRelationManager extends RelationManager
|
|||||||
{
|
{
|
||||||
return __('admin.events.relation_managers.event_packages.title');
|
return __('admin.events.relation_managers.event_packages.title');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTableQuery(): Builder|Relation
|
|
||||||
{
|
|
||||||
return parent::getTableQuery()->with('package');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -113,18 +113,64 @@ class EventTypeResource extends Resource
|
|||||||
SuperAdminAuditLogger::fieldsMetadata($data),
|
SuperAdminAuditLogger::fieldsMetadata($data),
|
||||||
static::class
|
static::class
|
||||||
)),
|
)),
|
||||||
|
Actions\DeleteAction::make()
|
||||||
|
->action(function (EventType $record, Actions\DeleteAction $action) {
|
||||||
|
try {
|
||||||
|
$record->delete();
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$isConstraint = ($e instanceof \Illuminate\Database\QueryException && ($e->getCode() == 23000 || ($e->errorInfo[0] ?? '') == 23000));
|
||||||
|
|
||||||
|
if ($isConstraint) {
|
||||||
|
\Filament\Notifications\Notification::make()
|
||||||
|
->title(__('admin.common.error'))
|
||||||
|
->body(__('admin.event_types.messages.delete_constraint_error'))
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
|
||||||
|
$action->halt();
|
||||||
|
}
|
||||||
|
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
->after(fn (EventType $record) => app(SuperAdminAuditLogger::class)->recordModelMutation(
|
||||||
|
'deleted',
|
||||||
|
$record,
|
||||||
|
source: static::class
|
||||||
|
)),
|
||||||
])
|
])
|
||||||
->bulkActions([
|
->bulkActions([
|
||||||
Actions\DeleteBulkAction::make()
|
Actions\DeleteBulkAction::make()
|
||||||
->after(function (Collection $records): void {
|
->action(function (Collection $records, Actions\DeleteBulkAction $action) {
|
||||||
$logger = app(SuperAdminAuditLogger::class);
|
$logger = app(SuperAdminAuditLogger::class);
|
||||||
|
$deletedCount = 0;
|
||||||
|
$failedCount = 0;
|
||||||
|
|
||||||
foreach ($records as $record) {
|
foreach ($records as $record) {
|
||||||
$logger->recordModelMutation(
|
try {
|
||||||
'deleted',
|
$record->delete();
|
||||||
$record,
|
$logger->recordModelMutation('deleted', $record, source: static::class);
|
||||||
source: static::class
|
$deletedCount++;
|
||||||
);
|
} catch (\Exception $e) {
|
||||||
|
$isConstraint = ($e instanceof \Illuminate\Database\QueryException && ($e->getCode() == 23000 || ($e->errorInfo[0] ?? '') == 23000));
|
||||||
|
if ($isConstraint) {
|
||||||
|
$failedCount++;
|
||||||
|
} else {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($failedCount > 0) {
|
||||||
|
\Filament\Notifications\Notification::make()
|
||||||
|
->title(__('admin.common.error'))
|
||||||
|
->body(__('admin.event_types.messages.delete_constraint_error')." ($failedCount failed, $deletedCount deleted)")
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
|
||||||
|
if ($deletedCount === 0) {
|
||||||
|
$action->halt();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
]);
|
]);
|
||||||
|
|||||||
@@ -17,4 +17,3 @@ class ListMediaStorageTargets extends ListRecords
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ class PackageResource extends Resource
|
|||||||
->nullable()
|
->nullable()
|
||||||
->visible(fn ($get) => $get('type') === 'reseller'),
|
->visible(fn ($get) => $get('type') === 'reseller'),
|
||||||
Toggle::make('watermark_allowed')
|
Toggle::make('watermark_allowed')
|
||||||
->label('Wasserzeichen erlaubt')
|
->label('Eigenes Wasserzeichen erlaubt')
|
||||||
->default(true),
|
->default(true),
|
||||||
Toggle::make('branding_allowed')
|
Toggle::make('branding_allowed')
|
||||||
->label('Eigenes Branding erlaubt')
|
->label('Eigenes Branding erlaubt')
|
||||||
|
|||||||
@@ -14,4 +14,3 @@ class ListPurchaseHistories extends ListRecords
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,4 +14,3 @@ class ViewPurchaseHistory extends ViewRecord
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
namespace App\Filament\SuperAdmin\Pages\Auth;
|
namespace App\Filament\SuperAdmin\Pages\Auth;
|
||||||
|
|
||||||
use Filament\Auth\Pages\EditProfile as BaseEditProfile;
|
use Filament\Auth\Pages\EditProfile as BaseEditProfile;
|
||||||
use Filament\Forms\Components\TextInput;
|
|
||||||
use Filament\Forms\Components\Select;
|
use Filament\Forms\Components\Select;
|
||||||
|
use Filament\Forms\Components\TextInput;
|
||||||
use Filament\Schemas\Schema;
|
use Filament\Schemas\Schema;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class WatermarkSettingsPage extends Page
|
|||||||
return __('admin.nav.branding');
|
return __('admin.nav.branding');
|
||||||
}
|
}
|
||||||
|
|
||||||
public ?string $asset = null;
|
public $asset = [];
|
||||||
|
|
||||||
public string $position = 'bottom-right';
|
public string $position = 'bottom-right';
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ class WatermarkSettingsPage extends Page
|
|||||||
$settings = WatermarkSetting::query()->first();
|
$settings = WatermarkSetting::query()->first();
|
||||||
|
|
||||||
if ($settings) {
|
if ($settings) {
|
||||||
$this->asset = $settings->asset;
|
$this->asset = $settings->asset ? [$settings->asset] : [];
|
||||||
$this->position = $settings->position;
|
$this->position = $settings->position;
|
||||||
$this->opacity = (float) $settings->opacity;
|
$this->opacity = (float) $settings->opacity;
|
||||||
$this->scale = (float) $settings->scale;
|
$this->scale = (float) $settings->scale;
|
||||||
@@ -119,8 +119,14 @@ class WatermarkSettingsPage extends Page
|
|||||||
{
|
{
|
||||||
$this->validate();
|
$this->validate();
|
||||||
|
|
||||||
|
$state = $this->form->getState();
|
||||||
|
$asset = $state['asset'] ?? $this->asset;
|
||||||
|
if (is_array($asset)) {
|
||||||
|
$asset = $asset[0] ?? null;
|
||||||
|
}
|
||||||
|
|
||||||
$settings = WatermarkSetting::query()->firstOrNew([]);
|
$settings = WatermarkSetting::query()->firstOrNew([]);
|
||||||
$settings->asset = $this->asset;
|
$settings->asset = $asset;
|
||||||
$settings->position = $this->position;
|
$settings->position = $this->position;
|
||||||
$settings->opacity = $this->opacity;
|
$settings->opacity = $this->opacity;
|
||||||
$settings->scale = $this->scale;
|
$settings->scale = $this->scale;
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ namespace App\Filament\Widgets;
|
|||||||
|
|
||||||
use Filament\Widgets\StatsOverviewWidget as BaseWidget;
|
use Filament\Widgets\StatsOverviewWidget as BaseWidget;
|
||||||
use Filament\Widgets\StatsOverviewWidget\Stat;
|
use Filament\Widgets\StatsOverviewWidget\Stat;
|
||||||
use Illuminate\Support\Facades\DB;
|
|
||||||
use Illuminate\Support\Carbon;
|
use Illuminate\Support\Carbon;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
class PlatformStatsWidget extends BaseWidget
|
class PlatformStatsWidget extends BaseWidget
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ use Filament\Widgets\LineChartWidget;
|
|||||||
|
|
||||||
class RevenueTrendWidget extends LineChartWidget
|
class RevenueTrendWidget extends LineChartWidget
|
||||||
{
|
{
|
||||||
|
|
||||||
protected static ?int $sort = 1;
|
protected static ?int $sort = 1;
|
||||||
|
|
||||||
protected int|string|array $columnSpan = 'full';
|
protected int|string|array $columnSpan = 'full';
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
namespace App\Filament\Widgets;
|
namespace App\Filament\Widgets;
|
||||||
|
|
||||||
|
use App\Models\Tenant;
|
||||||
use Filament\Tables;
|
use Filament\Tables;
|
||||||
use Filament\Widgets\TableWidget as BaseWidget;
|
use Filament\Widgets\TableWidget as BaseWidget;
|
||||||
use App\Models\Tenant;
|
|
||||||
|
|
||||||
class TopTenantsByUploads extends BaseWidget
|
class TopTenantsByUploads extends BaseWidget
|
||||||
{
|
{
|
||||||
@@ -14,6 +14,7 @@ class TopTenantsByUploads extends BaseWidget
|
|||||||
{
|
{
|
||||||
return __('admin.widgets.top_tenants_by_uploads.heading');
|
return __('admin.widgets.top_tenants_by_uploads.heading');
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ?string $pollingInterval = '60s';
|
protected ?string $pollingInterval = '60s';
|
||||||
|
|
||||||
public function table(Tables\Table $table): Tables\Table
|
public function table(Tables\Table $table): Tables\Table
|
||||||
@@ -33,4 +34,3 @@ class TopTenantsByUploads extends BaseWidget
|
|||||||
->paginated(false);
|
->paginated(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\Admin;
|
namespace App\Http\Controllers\Admin;
|
||||||
|
|
||||||
use Illuminate\Routing\Controller as BaseController;
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Routing\Controller as BaseController;
|
||||||
use SimpleSoftwareIO\QrCode\Facades\QrCode;
|
use SimpleSoftwareIO\QrCode\Facades\QrCode;
|
||||||
|
|
||||||
class QrController extends BaseController
|
class QrController extends BaseController
|
||||||
@@ -15,7 +15,7 @@ class QrController extends BaseController
|
|||||||
return response('missing data', 400);
|
return response('missing data', 400);
|
||||||
}
|
}
|
||||||
$png = QrCode::format('png')->size(300)->generate($data);
|
$png = QrCode::format('png')->size(300)->generate($data);
|
||||||
|
|
||||||
return response($png, 200, ['Content-Type' => 'image/png']);
|
return response($png, 200, ['Content-Type' => 'image/png']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -185,6 +185,57 @@ class EventPublicController extends BaseController
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$deviceId = (string) $request->header('X-Device-Id', $request->input('device_id', ''));
|
||||||
|
$deviceId = $deviceId !== '' ? $deviceId : null;
|
||||||
|
|
||||||
|
if ($event->id ?? null) {
|
||||||
|
$eventModel = Event::with(['tenant', 'eventPackage.package', 'eventPackages.package'])->find($event->id);
|
||||||
|
if ($eventModel && $eventModel->tenant) {
|
||||||
|
$eventPackage = $this->packageLimitEvaluator->resolveEventPackageForPhotoUpload(
|
||||||
|
$eventModel->tenant,
|
||||||
|
$eventModel->id,
|
||||||
|
$eventModel
|
||||||
|
);
|
||||||
|
$maxGuests = $eventPackage?->effectiveGuestLimit();
|
||||||
|
|
||||||
|
if ($eventPackage && $maxGuests !== null) {
|
||||||
|
$grace = (int) config('package-limits.guest_grace', 10);
|
||||||
|
$hardLimit = $maxGuests + max(0, $grace);
|
||||||
|
$usedGuests = (int) $eventPackage->used_guests;
|
||||||
|
$isReturningGuest = $this->joinTokenService->hasSeenGuest($eventModel->id, $deviceId, $request->ip());
|
||||||
|
|
||||||
|
if ($usedGuests >= $hardLimit && ! $isReturningGuest) {
|
||||||
|
$this->recordTokenEvent(
|
||||||
|
$joinToken,
|
||||||
|
$request,
|
||||||
|
'guest_limit_exceeded',
|
||||||
|
[
|
||||||
|
'event_id' => $eventModel->id,
|
||||||
|
'used' => $usedGuests,
|
||||||
|
'limit' => $maxGuests,
|
||||||
|
'hard_limit' => $hardLimit,
|
||||||
|
],
|
||||||
|
$token,
|
||||||
|
Response::HTTP_PAYMENT_REQUIRED
|
||||||
|
);
|
||||||
|
|
||||||
|
return ApiError::response(
|
||||||
|
'guest_limit_exceeded',
|
||||||
|
__('api.packages.guest_limit_exceeded.title'),
|
||||||
|
__('api.packages.guest_limit_exceeded.message'),
|
||||||
|
Response::HTTP_PAYMENT_REQUIRED,
|
||||||
|
[
|
||||||
|
'event_id' => $eventModel->id,
|
||||||
|
'used' => $usedGuests,
|
||||||
|
'limit' => $maxGuests,
|
||||||
|
'hard_limit' => $hardLimit,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
RateLimiter::clear($rateLimiterKey);
|
RateLimiter::clear($rateLimiterKey);
|
||||||
|
|
||||||
if (isset($event->status)) {
|
if (isset($event->status)) {
|
||||||
@@ -1025,10 +1076,10 @@ class EventPublicController extends BaseController
|
|||||||
private function resolveBrandingPayload(Event $event): array
|
private function resolveBrandingPayload(Event $event): array
|
||||||
{
|
{
|
||||||
$defaults = [
|
$defaults = [
|
||||||
'primary' => '#f43f5e',
|
'primary' => '#FF5A5F',
|
||||||
'secondary' => '#fb7185',
|
'secondary' => '#FFF8F5',
|
||||||
'background' => '#ffffff',
|
'background' => '#FFF8F5',
|
||||||
'surface' => '#ffffff',
|
'surface' => '#FFF8F5',
|
||||||
'font' => null,
|
'font' => null,
|
||||||
'size' => 'm',
|
'size' => 'm',
|
||||||
'logo_position' => 'left',
|
'logo_position' => 'left',
|
||||||
@@ -1298,7 +1349,7 @@ class EventPublicController extends BaseController
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$diskName = config('filesystems.default', 'public');
|
$diskName = 'public';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$storage = Storage::disk($diskName);
|
$storage = Storage::disk($diskName);
|
||||||
@@ -1906,7 +1957,9 @@ class EventPublicController extends BaseController
|
|||||||
$policy = $this->guestPolicy();
|
$policy = $this->guestPolicy();
|
||||||
|
|
||||||
if ($joinToken) {
|
if ($joinToken) {
|
||||||
$this->joinTokenService->incrementUsage($joinToken);
|
$deviceId = (string) $request->header('X-Device-Id', $request->input('device_id', ''));
|
||||||
|
$deviceId = $deviceId !== '' ? $deviceId : null;
|
||||||
|
$this->joinTokenService->incrementUsage($joinToken, $deviceId, $request->ip());
|
||||||
}
|
}
|
||||||
|
|
||||||
$demoReadOnly = (bool) Arr::get($joinToken?->metadata ?? [], 'demo_read_only', false);
|
$demoReadOnly = (bool) Arr::get($joinToken?->metadata ?? [], 'demo_read_only', false);
|
||||||
@@ -2921,6 +2974,12 @@ class EventPublicController extends BaseController
|
|||||||
$policy = $this->guestPolicy();
|
$policy = $this->guestPolicy();
|
||||||
$uploadVisibility = Arr::get($eventModel->settings ?? [], 'guest_upload_visibility', $policy->guest_upload_visibility);
|
$uploadVisibility = Arr::get($eventModel->settings ?? [], 'guest_upload_visibility', $policy->guest_upload_visibility);
|
||||||
$autoApproveUploads = $uploadVisibility === 'immediate';
|
$autoApproveUploads = $uploadVisibility === 'immediate';
|
||||||
|
$controlRoom = Arr::get($eventModel->settings ?? [], 'control_room', []);
|
||||||
|
$controlRoom = is_array($controlRoom) ? $controlRoom : [];
|
||||||
|
$autoAddApprovedToLiveSetting = (bool) Arr::get($controlRoom, 'auto_add_approved_to_live', true);
|
||||||
|
$trustedUploaders = Arr::get($controlRoom, 'trusted_uploaders', []);
|
||||||
|
$forceReviewUploaders = Arr::get($controlRoom, 'force_review_uploaders', []);
|
||||||
|
$autoAddApprovedToLiveDefault = $autoAddApprovedToLiveSetting || $autoApproveUploads;
|
||||||
|
|
||||||
$tenantModel = $eventModel->tenant;
|
$tenantModel = $eventModel->tenant;
|
||||||
|
|
||||||
@@ -2953,6 +3012,34 @@ class EventPublicController extends BaseController
|
|||||||
->resolveEventPackageForPhotoUpload($tenantModel, $eventId, $eventModel);
|
->resolveEventPackageForPhotoUpload($tenantModel, $eventId, $eventModel);
|
||||||
|
|
||||||
$deviceId = $this->resolveDeviceIdentifier($request);
|
$deviceId = $this->resolveDeviceIdentifier($request);
|
||||||
|
$deviceHasRule = static function (array $entries, string $deviceId): bool {
|
||||||
|
foreach ($entries as $entry) {
|
||||||
|
if (! is_array($entry)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$candidate = $entry['device_id'] ?? null;
|
||||||
|
if (is_string($candidate) && $candidate === $deviceId) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
$deviceHasRules = $deviceId !== 'anonymous';
|
||||||
|
$isForceReviewUploader = $deviceHasRules && is_array($forceReviewUploaders)
|
||||||
|
? $deviceHasRule($forceReviewUploaders, $deviceId)
|
||||||
|
: false;
|
||||||
|
$isTrustedUploader = $deviceHasRules && is_array($trustedUploaders)
|
||||||
|
? $deviceHasRule($trustedUploaders, $deviceId)
|
||||||
|
: false;
|
||||||
|
|
||||||
|
if ($isForceReviewUploader) {
|
||||||
|
$autoApproveUploads = false;
|
||||||
|
} elseif ($isTrustedUploader) {
|
||||||
|
$autoApproveUploads = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$autoAddApprovedToLive = $autoAddApprovedToLiveDefault && $autoApproveUploads;
|
||||||
|
|
||||||
$deviceLimit = max(0, (int) ($policy->per_device_upload_limit ?? 50));
|
$deviceLimit = max(0, (int) ($policy->per_device_upload_limit ?? 50));
|
||||||
$deviceCount = DB::table('photos')->where('event_id', $eventId)->where('guest_name', $deviceId)->count();
|
$deviceCount = DB::table('photos')->where('event_id', $eventId)->where('guest_name', $deviceId)->count();
|
||||||
@@ -3037,10 +3124,21 @@ class EventPublicController extends BaseController
|
|||||||
$liveApprovedAt = null;
|
$liveApprovedAt = null;
|
||||||
$liveReviewedAt = null;
|
$liveReviewedAt = null;
|
||||||
$liveStatus = PhotoLiveStatus::NONE->value;
|
$liveStatus = PhotoLiveStatus::NONE->value;
|
||||||
|
$securityMeta = $isForceReviewUploader
|
||||||
|
? [
|
||||||
|
'manual_review' => true,
|
||||||
|
'manual_review_reason' => 'force_review_device',
|
||||||
|
]
|
||||||
|
: null;
|
||||||
|
$securityMetaValue = $securityMeta ? json_encode($securityMeta) : null;
|
||||||
|
|
||||||
if ($liveOptIn) {
|
if ($liveOptIn || $autoAddApprovedToLive) {
|
||||||
$liveSubmittedAt = now();
|
$liveSubmittedAt = now();
|
||||||
if ($liveModerationMode === 'off') {
|
if ($autoAddApprovedToLive) {
|
||||||
|
$liveStatus = PhotoLiveStatus::APPROVED->value;
|
||||||
|
$liveApprovedAt = $liveSubmittedAt;
|
||||||
|
$liveReviewedAt = $liveSubmittedAt;
|
||||||
|
} elseif ($liveModerationMode === 'off') {
|
||||||
$liveStatus = PhotoLiveStatus::APPROVED->value;
|
$liveStatus = PhotoLiveStatus::APPROVED->value;
|
||||||
$liveApprovedAt = $liveSubmittedAt;
|
$liveApprovedAt = $liveSubmittedAt;
|
||||||
$liveReviewedAt = $liveSubmittedAt;
|
$liveReviewedAt = $liveSubmittedAt;
|
||||||
@@ -3048,6 +3146,12 @@ class EventPublicController extends BaseController
|
|||||||
$liveStatus = PhotoLiveStatus::PENDING->value;
|
$liveStatus = PhotoLiveStatus::PENDING->value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($isForceReviewUploader) {
|
||||||
|
$liveStatus = PhotoLiveStatus::REJECTED->value;
|
||||||
|
$liveSubmittedAt = null;
|
||||||
|
$liveApprovedAt = null;
|
||||||
|
$liveReviewedAt = now();
|
||||||
|
}
|
||||||
|
|
||||||
$photoId = DB::table('photos')->insertGetId([
|
$photoId = DB::table('photos')->insertGetId([
|
||||||
'event_id' => $eventId,
|
'event_id' => $eventId,
|
||||||
@@ -3071,6 +3175,7 @@ class EventPublicController extends BaseController
|
|||||||
'emotion_id' => $this->resolveEmotionId($validated, $eventId),
|
'emotion_id' => $this->resolveEmotionId($validated, $eventId),
|
||||||
'is_featured' => 0,
|
'is_featured' => 0,
|
||||||
'metadata' => null,
|
'metadata' => null,
|
||||||
|
'security_meta' => $securityMetaValue,
|
||||||
'created_at' => now(),
|
'created_at' => now(),
|
||||||
'updated_at' => now(),
|
'updated_at' => now(),
|
||||||
]);
|
]);
|
||||||
|
|||||||
@@ -26,11 +26,11 @@ class LegalController extends BaseController
|
|||||||
'allow_unsafe_links' => false,
|
'allow_unsafe_links' => false,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$environment->addExtension(new CommonMarkCoreExtension());
|
$environment->addExtension(new CommonMarkCoreExtension);
|
||||||
$environment->addExtension(new TableExtension());
|
$environment->addExtension(new TableExtension);
|
||||||
$environment->addExtension(new AutolinkExtension());
|
$environment->addExtension(new AutolinkExtension);
|
||||||
$environment->addExtension(new StrikethroughExtension());
|
$environment->addExtension(new StrikethroughExtension);
|
||||||
$environment->addExtension(new TaskListExtension());
|
$environment->addExtension(new TaskListExtension);
|
||||||
|
|
||||||
$this->markdown = new MarkdownConverter($environment);
|
$this->markdown = new MarkdownConverter($environment);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -277,13 +277,13 @@ class PackageController extends Controller
|
|||||||
'purchased_at' => now(),
|
'purchased_at' => now(),
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
// Reseller subscription
|
// Partner / reseller Event-Kontingent package
|
||||||
\App\Models\TenantPackage::create([
|
\App\Models\TenantPackage::create([
|
||||||
'tenant_id' => $tenant->id,
|
'tenant_id' => $tenant->id,
|
||||||
'package_id' => $package->id,
|
'package_id' => $package->id,
|
||||||
'price' => $package->price,
|
'price' => $package->price,
|
||||||
'purchased_at' => now(),
|
'purchased_at' => now(),
|
||||||
'expires_at' => now()->addYear(),
|
'expires_at' => null,
|
||||||
'active' => true,
|
'active' => true,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ namespace App\Http\Controllers\Api;
|
|||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Http\Requests\Photobooth\PhotoboothConnectRedeemRequest;
|
use App\Http\Requests\Photobooth\PhotoboothConnectRedeemRequest;
|
||||||
|
use App\Models\Event;
|
||||||
use App\Services\Photobooth\PhotoboothConnectCodeService;
|
use App\Services\Photobooth\PhotoboothConnectCodeService;
|
||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
|
|
||||||
@@ -33,7 +34,8 @@ class PhotoboothConnectController extends Controller
|
|||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'data' => [
|
'data' => [
|
||||||
'upload_url' => route('api.v1.photobooth.sparkbooth.upload'),
|
'event_name' => $this->resolveEventName($event),
|
||||||
|
'upload_url' => route('api.v1.photobooth.upload'),
|
||||||
'username' => $setting->username,
|
'username' => $setting->username,
|
||||||
'password' => $setting->password,
|
'password' => $setting->password,
|
||||||
'expires_at' => optional($setting->expires_at)->toIso8601String(),
|
'expires_at' => optional($setting->expires_at)->toIso8601String(),
|
||||||
@@ -42,4 +44,27 @@ class PhotoboothConnectController extends Controller
|
|||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function resolveEventName(?Event $event): ?string
|
||||||
|
{
|
||||||
|
if (! $event) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$name = $event->name;
|
||||||
|
|
||||||
|
if (is_string($name) && trim($name) !== '') {
|
||||||
|
return $name;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_array($name)) {
|
||||||
|
foreach ($name as $value) {
|
||||||
|
if (is_string($value) && trim($value) !== '') {
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $event->slug ?: null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ use App\Models\Event;
|
|||||||
use App\Services\Analytics\EventAnalyticsService;
|
use App\Services\Analytics\EventAnalyticsService;
|
||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Arr;
|
|
||||||
|
|
||||||
class EventAnalyticsController extends Controller
|
class EventAnalyticsController extends Controller
|
||||||
{
|
{
|
||||||
@@ -26,10 +25,10 @@ class EventAnalyticsController extends Controller
|
|||||||
|
|
||||||
$hasAccess = in_array('advanced_analytics', $packageFeatures, true);
|
$hasAccess = in_array('advanced_analytics', $packageFeatures, true);
|
||||||
|
|
||||||
if (!$hasAccess) {
|
if (! $hasAccess) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'message' => 'This feature is only available in the Premium package.',
|
'message' => 'This feature is only available in the Premium package.',
|
||||||
'code' => 'feature_locked'
|
'code' => 'feature_locked',
|
||||||
], 403);
|
], 403);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ use App\Models\Tenant;
|
|||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Services\EventJoinTokenService;
|
use App\Services\EventJoinTokenService;
|
||||||
use App\Support\ApiError;
|
use App\Support\ApiError;
|
||||||
|
use App\Support\TenantMemberPermissions;
|
||||||
|
use App\Support\WatermarkConfigResolver;
|
||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Http\Resources\Json\AnonymousResourceCollection;
|
use Illuminate\Http\Resources\Json\AnonymousResourceCollection;
|
||||||
@@ -83,6 +85,8 @@ class EventController extends Controller
|
|||||||
|
|
||||||
public function store(EventStoreRequest $request): JsonResponse
|
public function store(EventStoreRequest $request): JsonResponse
|
||||||
{
|
{
|
||||||
|
TenantMemberPermissions::ensureTenantPermission($request, 'events:manage');
|
||||||
|
|
||||||
$tenant = $request->attributes->get('tenant');
|
$tenant = $request->attributes->get('tenant');
|
||||||
if (! $tenant instanceof Tenant) {
|
if (! $tenant instanceof Tenant) {
|
||||||
$tenantId = $request->attributes->get('tenant_id');
|
$tenantId = $request->attributes->get('tenant_id');
|
||||||
@@ -99,6 +103,9 @@ class EventController extends Controller
|
|||||||
|
|
||||||
$requestedPackageId = $isSuperAdmin ? $request->integer('package_id') : null;
|
$requestedPackageId = $isSuperAdmin ? $request->integer('package_id') : null;
|
||||||
unset($validated['package_id']);
|
unset($validated['package_id']);
|
||||||
|
$requestedServiceSlug = $request->input('service_package_slug');
|
||||||
|
$requestedServiceSlug = is_string($requestedServiceSlug) && $requestedServiceSlug !== '' ? $requestedServiceSlug : null;
|
||||||
|
unset($validated['service_package_slug']);
|
||||||
|
|
||||||
$tenantPackage = $tenant->tenantPackages()
|
$tenantPackage = $tenant->tenantPackages()
|
||||||
->with('package')
|
->with('package')
|
||||||
@@ -116,6 +123,18 @@ class EventController extends Controller
|
|||||||
$package = $this->resolveOwnerPackage();
|
$package = $this->resolveOwnerPackage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$billingTenantPackage = null;
|
||||||
|
if (! $package) {
|
||||||
|
$billingTenantPackage = $requestedServiceSlug
|
||||||
|
? $tenant->getActiveResellerPackageFor($requestedServiceSlug)
|
||||||
|
: $tenant->getActiveResellerPackage();
|
||||||
|
|
||||||
|
if ($billingTenantPackage && $billingTenantPackage->package) {
|
||||||
|
$package = $billingTenantPackage->package;
|
||||||
|
$requestedServiceSlug = $requestedServiceSlug ?: $package->included_package_slug;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (! $package && $tenantPackage) {
|
if (! $package && $tenantPackage) {
|
||||||
$package = $tenantPackage->package ?? Package::query()->find($tenantPackage->package_id);
|
$package = $tenantPackage->package ?? Package::query()->find($tenantPackage->package_id);
|
||||||
}
|
}
|
||||||
@@ -126,6 +145,11 @@ class EventController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$billingIsReseller = $package->isReseller();
|
||||||
|
$eventServicePackage = $billingIsReseller
|
||||||
|
? $this->resolveResellerEventPackageForSlug($requestedServiceSlug ?: $package->included_package_slug)
|
||||||
|
: $package;
|
||||||
|
|
||||||
$requiresWaiver = $package->isEndcustomer();
|
$requiresWaiver = $package->isEndcustomer();
|
||||||
$latestPurchase = $requiresWaiver ? $this->resolveLatestPackagePurchase($tenant, $package) : null;
|
$latestPurchase = $requiresWaiver ? $this->resolveLatestPackagePurchase($tenant, $package) : null;
|
||||||
$existingWaiver = $latestPurchase ? data_get($latestPurchase->metadata, 'consents.digital_content_waiver_at') : null;
|
$existingWaiver = $latestPurchase ? data_get($latestPurchase->metadata, 'consents.digital_content_waiver_at') : null;
|
||||||
@@ -161,8 +185,8 @@ class EventController extends Controller
|
|||||||
unset($eventData['features']);
|
unset($eventData['features']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$settings['branding_allowed'] = $package->branding_allowed !== false;
|
$settings['branding_allowed'] = $eventServicePackage->branding_allowed !== false;
|
||||||
$settings['watermark_allowed'] = $package->watermark_allowed !== false;
|
$settings['watermark_allowed'] = $eventServicePackage->watermark_allowed !== false;
|
||||||
|
|
||||||
$eventData['settings'] = $settings;
|
$eventData['settings'] = $settings;
|
||||||
|
|
||||||
@@ -190,21 +214,23 @@ class EventController extends Controller
|
|||||||
|
|
||||||
$eventData = Arr::only($eventData, $allowed);
|
$eventData = Arr::only($eventData, $allowed);
|
||||||
|
|
||||||
$event = DB::transaction(function () use ($tenant, $eventData, $package, $isSuperAdmin) {
|
$event = DB::transaction(function () use ($tenant, $eventData, $eventServicePackage, $billingIsReseller, $isSuperAdmin) {
|
||||||
$event = Event::create($eventData);
|
$event = Event::create($eventData);
|
||||||
|
|
||||||
EventPackage::create([
|
EventPackage::create([
|
||||||
'event_id' => $event->id,
|
'event_id' => $event->id,
|
||||||
'package_id' => $package->id,
|
'package_id' => $eventServicePackage->id,
|
||||||
'purchased_price' => $package->price,
|
'purchased_price' => $billingIsReseller ? 0 : $eventServicePackage->price,
|
||||||
'purchased_at' => now(),
|
'purchased_at' => now(),
|
||||||
'gallery_expires_at' => $package->gallery_days ? now()->addDays($package->gallery_days) : null,
|
'gallery_expires_at' => $eventServicePackage->gallery_days
|
||||||
|
? now()->addDays($eventServicePackage->gallery_days)
|
||||||
|
: null,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if ($package->isReseller() && ! $isSuperAdmin) {
|
if ($billingIsReseller && ! $isSuperAdmin) {
|
||||||
$note = sprintf('Event #%d created (%s)', $event->id, $event->name);
|
$note = sprintf('Event #%d created (%s)', $event->id, $event->name);
|
||||||
|
|
||||||
if (! $tenant->consumeEventAllowance(1, 'event.create', $note)) {
|
if (! $tenant->consumeEventAllowanceFor($eventServicePackage->slug, 1, 'event.create', $note)) {
|
||||||
throw new HttpException(402, 'Insufficient package allowance.');
|
throw new HttpException(402, 'Insufficient package allowance.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -227,6 +253,47 @@ class EventController extends Controller
|
|||||||
], 201);
|
], 201);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function resolveResellerDefaultEventPackage(): Package
|
||||||
|
{
|
||||||
|
return $this->resolveResellerEventPackageForSlug('standard');
|
||||||
|
}
|
||||||
|
|
||||||
|
private function resolveResellerEventPackageForSlug(?string $slug): Package
|
||||||
|
{
|
||||||
|
if (is_string($slug) && $slug !== '') {
|
||||||
|
$match = Package::query()
|
||||||
|
->where('type', 'endcustomer')
|
||||||
|
->where('slug', $slug)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if ($match) {
|
||||||
|
return $match;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$default = Package::query()
|
||||||
|
->where('type', 'endcustomer')
|
||||||
|
->where('slug', 'standard')
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if ($default) {
|
||||||
|
return $default;
|
||||||
|
}
|
||||||
|
|
||||||
|
$fallback = Package::query()
|
||||||
|
->where('type', 'endcustomer')
|
||||||
|
->orderBy('price')
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if (! $fallback) {
|
||||||
|
throw ValidationException::withMessages([
|
||||||
|
'package_id' => __('Aktuell ist kein Endkunden-Paket verfügbar. Bitte kontaktiere den Support.'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $fallback;
|
||||||
|
}
|
||||||
|
|
||||||
private function resolveLatestPackagePurchase(Tenant $tenant, Package $package): ?PackagePurchase
|
private function resolveLatestPackagePurchase(Tenant $tenant, Package $package): ?PackagePurchase
|
||||||
{
|
{
|
||||||
return PackagePurchase::query()
|
return PackagePurchase::query()
|
||||||
@@ -320,14 +387,24 @@ class EventController extends Controller
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TenantMemberPermissions::ensureEventPermission($request, $event, 'events:manage');
|
||||||
|
|
||||||
$validated = $request->validated();
|
$validated = $request->validated();
|
||||||
|
$nameProvided = array_key_exists('name', $validated);
|
||||||
|
|
||||||
|
$validated = array_merge([
|
||||||
|
'name' => $event->name,
|
||||||
|
'event_type_id' => $event->event_type_id,
|
||||||
|
'event_date' => $event->date?->toDateString(),
|
||||||
|
'status' => $event->status,
|
||||||
|
], $validated);
|
||||||
|
|
||||||
if (isset($validated['event_date'])) {
|
if (isset($validated['event_date'])) {
|
||||||
$validated['date'] = $validated['event_date'];
|
$validated['date'] = $validated['event_date'];
|
||||||
unset($validated['event_date']);
|
unset($validated['event_date']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($validated['name'] !== $event->name) {
|
if ($nameProvided && $validated['name'] !== $event->name) {
|
||||||
$validated['slug'] = $this->generateUniqueSlug($validated['name'], $tenantId, $event->id);
|
$validated['slug'] = $this->generateUniqueSlug($validated['name'], $tenantId, $event->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -338,6 +415,7 @@ class EventController extends Controller
|
|||||||
$package = $event->eventPackage?->package;
|
$package = $event->eventPackage?->package;
|
||||||
$brandingAllowed = optional($package)->branding_allowed !== false;
|
$brandingAllowed = optional($package)->branding_allowed !== false;
|
||||||
$watermarkAllowed = optional($package)->watermark_allowed !== false;
|
$watermarkAllowed = optional($package)->watermark_allowed !== false;
|
||||||
|
$watermarkRemovalAllowed = WatermarkConfigResolver::determineRemovalAllowed($event);
|
||||||
|
|
||||||
if (isset($validated['settings']) && is_array($validated['settings'])) {
|
if (isset($validated['settings']) && is_array($validated['settings'])) {
|
||||||
$validated['settings'] = array_merge($event->settings ?? [], $validated['settings']);
|
$validated['settings'] = array_merge($event->settings ?? [], $validated['settings']);
|
||||||
@@ -347,32 +425,37 @@ class EventController extends Controller
|
|||||||
|
|
||||||
$validated['settings']['branding_allowed'] = $brandingAllowed;
|
$validated['settings']['branding_allowed'] = $brandingAllowed;
|
||||||
$validated['settings']['watermark_allowed'] = $watermarkAllowed;
|
$validated['settings']['watermark_allowed'] = $watermarkAllowed;
|
||||||
|
$validated['settings']['watermark_removal_allowed'] = $watermarkRemovalAllowed;
|
||||||
|
|
||||||
$settings = $validated['settings'];
|
$settings = $validated['settings'];
|
||||||
|
$branding = Arr::get($settings, 'branding', []);
|
||||||
$watermark = Arr::get($settings, 'watermark', []);
|
$watermark = Arr::get($settings, 'watermark', []);
|
||||||
$existingWatermark = is_array($watermark) ? $watermark : [];
|
$existingWatermark = is_array($watermark) ? $watermark : [];
|
||||||
|
|
||||||
|
if (is_array($branding)) {
|
||||||
|
$settings['branding'] = $this->normalizeBrandingSettings($branding, $event, $brandingAllowed);
|
||||||
|
}
|
||||||
|
|
||||||
if (is_array($watermark)) {
|
if (is_array($watermark)) {
|
||||||
$mode = $watermark['mode'] ?? 'base';
|
$mode = $watermark['mode'] ?? 'base';
|
||||||
$policy = $watermarkAllowed ? 'basic' : 'none';
|
|
||||||
|
|
||||||
if (! $watermarkAllowed) {
|
if (! $watermarkAllowed) {
|
||||||
$mode = 'off';
|
$mode = 'base';
|
||||||
} elseif (! $brandingAllowed) {
|
} elseif (! $brandingAllowed) {
|
||||||
$mode = 'base';
|
$mode = 'base';
|
||||||
} elseif ($mode === 'off' && $policy === 'basic') {
|
} elseif ($mode === 'off' && ! $watermarkRemovalAllowed) {
|
||||||
$mode = 'base';
|
$mode = 'base';
|
||||||
}
|
}
|
||||||
|
|
||||||
$assetPath = $watermark['asset'] ?? null;
|
$assetPath = $watermark['asset'] ?? null;
|
||||||
$assetDataUrl = $watermark['asset_data_url'] ?? null;
|
$assetDataUrl = $watermark['asset_data_url'] ?? null;
|
||||||
|
|
||||||
if (! $watermarkAllowed) {
|
if (! $watermarkAllowed || $mode === 'off') {
|
||||||
$assetPath = null;
|
$assetPath = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($assetDataUrl && $mode === 'custom' && $brandingAllowed) {
|
if ($assetDataUrl && $mode === 'custom' && $brandingAllowed) {
|
||||||
if (! preg_match('/^data:image\\/(png|webp|jpe?g);base64,(.+)$/i', $assetDataUrl, $matches)) {
|
if (! preg_match('/^data:image\\/(png|webp|jpe?g|svg\\+xml);base64,(.+)$/i', $assetDataUrl, $matches)) {
|
||||||
throw ValidationException::withMessages([
|
throw ValidationException::withMessages([
|
||||||
'settings.watermark.asset_data_url' => __('Ungültiges Wasserzeichen-Bild.'),
|
'settings.watermark.asset_data_url' => __('Ungültiges Wasserzeichen-Bild.'),
|
||||||
]);
|
]);
|
||||||
@@ -392,7 +475,12 @@ class EventController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$extension = str_starts_with(strtolower($matches[1]), 'jp') ? 'jpg' : strtolower($matches[1]);
|
$mime = strtolower($matches[1]);
|
||||||
|
$extension = match (true) {
|
||||||
|
str_starts_with($mime, 'jp') => 'jpg',
|
||||||
|
str_starts_with($mime, 'svg') => 'svg',
|
||||||
|
default => $mime,
|
||||||
|
};
|
||||||
$path = sprintf('branding/watermarks/event-%s.%s', $event->id, $extension);
|
$path = sprintf('branding/watermarks/event-%s.%s', $event->id, $extension);
|
||||||
Storage::disk('public')->put($path, $decoded);
|
Storage::disk('public')->put($path, $decoded);
|
||||||
$assetPath = $path;
|
$assetPath = $path;
|
||||||
@@ -442,6 +530,68 @@ class EventController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<string, mixed> $branding
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
private function normalizeBrandingSettings(array $branding, Event $event, bool $brandingAllowed): array
|
||||||
|
{
|
||||||
|
$logoDataUrl = $branding['logo_data_url'] ?? null;
|
||||||
|
|
||||||
|
if (! $brandingAllowed) {
|
||||||
|
unset($branding['logo_data_url']);
|
||||||
|
|
||||||
|
return $branding;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! is_string($logoDataUrl) || trim($logoDataUrl) === '') {
|
||||||
|
unset($branding['logo_data_url']);
|
||||||
|
|
||||||
|
return $branding;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! preg_match('/^data:image\\/(png|webp|jpe?g);base64,(.+)$/i', $logoDataUrl, $matches)) {
|
||||||
|
throw ValidationException::withMessages([
|
||||||
|
'settings.branding.logo_data_url' => __('Ungültiges Branding-Logo.'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$decoded = base64_decode($matches[2], true);
|
||||||
|
|
||||||
|
if ($decoded === false) {
|
||||||
|
throw ValidationException::withMessages([
|
||||||
|
'settings.branding.logo_data_url' => __('Branding-Logo konnte nicht gelesen werden.'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strlen($decoded) > 1024 * 1024) { // 1 MB
|
||||||
|
throw ValidationException::withMessages([
|
||||||
|
'settings.branding.logo_data_url' => __('Branding-Logo ist zu groß (max. 1 MB).'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$extension = str_starts_with(strtolower($matches[1]), 'jp') ? 'jpg' : strtolower($matches[1]);
|
||||||
|
$path = sprintf('branding/logos/event-%s.%s', $event->id, $extension);
|
||||||
|
Storage::disk('public')->put($path, $decoded);
|
||||||
|
|
||||||
|
$branding['logo_url'] = $path;
|
||||||
|
$branding['logo_mode'] = 'upload';
|
||||||
|
$branding['logo_value'] = $path;
|
||||||
|
|
||||||
|
$logo = $branding['logo'] ?? [];
|
||||||
|
if (! is_array($logo)) {
|
||||||
|
$logo = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$logo['mode'] = 'upload';
|
||||||
|
$logo['value'] = $path;
|
||||||
|
$branding['logo'] = $logo;
|
||||||
|
|
||||||
|
unset($branding['logo_data_url']);
|
||||||
|
|
||||||
|
return $branding;
|
||||||
|
}
|
||||||
|
|
||||||
public function destroy(Request $request, Event $event): JsonResponse
|
public function destroy(Request $request, Event $event): JsonResponse
|
||||||
{
|
{
|
||||||
$tenantId = $request->attributes->get('tenant_id');
|
$tenantId = $request->attributes->get('tenant_id');
|
||||||
@@ -456,6 +606,8 @@ class EventController extends Controller
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TenantMemberPermissions::ensureEventPermission($request, $event, 'events:manage');
|
||||||
|
|
||||||
$event->delete();
|
$event->delete();
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ use App\Models\Event;
|
|||||||
use App\Models\GuestNotification;
|
use App\Models\GuestNotification;
|
||||||
use App\Models\GuestPolicySetting;
|
use App\Models\GuestPolicySetting;
|
||||||
use App\Services\GuestNotificationService;
|
use App\Services\GuestNotificationService;
|
||||||
|
use App\Support\TenantMemberPermissions;
|
||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Validation\ValidationException;
|
use Illuminate\Validation\ValidationException;
|
||||||
@@ -23,6 +24,7 @@ class EventGuestNotificationController extends Controller
|
|||||||
public function index(Request $request, Event $event): JsonResponse
|
public function index(Request $request, Event $event): JsonResponse
|
||||||
{
|
{
|
||||||
$this->assertEventTenant($request, $event);
|
$this->assertEventTenant($request, $event);
|
||||||
|
TenantMemberPermissions::ensureEventPermission($request, $event, 'guest-notifications:manage');
|
||||||
|
|
||||||
$limit = max(1, min(100, (int) $request->integer('limit', 25)));
|
$limit = max(1, min(100, (int) $request->integer('limit', 25)));
|
||||||
|
|
||||||
@@ -38,6 +40,7 @@ class EventGuestNotificationController extends Controller
|
|||||||
public function store(BroadcastGuestNotificationRequest $request, Event $event): JsonResponse
|
public function store(BroadcastGuestNotificationRequest $request, Event $event): JsonResponse
|
||||||
{
|
{
|
||||||
$this->assertEventTenant($request, $event);
|
$this->assertEventTenant($request, $event);
|
||||||
|
TenantMemberPermissions::ensureEventPermission($request, $event, 'guest-notifications:manage');
|
||||||
|
|
||||||
$data = $request->validated();
|
$data = $request->validated();
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ use App\Http\Resources\Tenant\EventJoinTokenResource;
|
|||||||
use App\Models\Event;
|
use App\Models\Event;
|
||||||
use App\Models\EventJoinToken;
|
use App\Models\EventJoinToken;
|
||||||
use App\Services\EventJoinTokenService;
|
use App\Services\EventJoinTokenService;
|
||||||
|
use App\Support\TenantMemberPermissions;
|
||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Http\Resources\Json\AnonymousResourceCollection;
|
use Illuminate\Http\Resources\Json\AnonymousResourceCollection;
|
||||||
@@ -19,7 +20,7 @@ class EventJoinTokenController extends Controller
|
|||||||
|
|
||||||
public function index(Request $request, Event $event): AnonymousResourceCollection
|
public function index(Request $request, Event $event): AnonymousResourceCollection
|
||||||
{
|
{
|
||||||
$this->authorizeEvent($request, $event);
|
$this->authorizeEvent($request, $event, 'join-tokens:manage');
|
||||||
|
|
||||||
$tokens = $event->joinTokens()
|
$tokens = $event->joinTokens()
|
||||||
->orderByDesc('created_at')
|
->orderByDesc('created_at')
|
||||||
@@ -30,7 +31,7 @@ class EventJoinTokenController extends Controller
|
|||||||
|
|
||||||
public function store(Request $request, Event $event): JsonResponse
|
public function store(Request $request, Event $event): JsonResponse
|
||||||
{
|
{
|
||||||
$this->authorizeEvent($request, $event);
|
$this->authorizeEvent($request, $event, 'join-tokens:manage');
|
||||||
|
|
||||||
$validated = $this->validatePayload($request);
|
$validated = $this->validatePayload($request);
|
||||||
|
|
||||||
@@ -45,7 +46,7 @@ class EventJoinTokenController extends Controller
|
|||||||
|
|
||||||
public function update(Request $request, Event $event, EventJoinToken $joinToken): EventJoinTokenResource
|
public function update(Request $request, Event $event, EventJoinToken $joinToken): EventJoinTokenResource
|
||||||
{
|
{
|
||||||
$this->authorizeEvent($request, $event);
|
$this->authorizeEvent($request, $event, 'join-tokens:manage');
|
||||||
|
|
||||||
if ($joinToken->event_id !== $event->id) {
|
if ($joinToken->event_id !== $event->id) {
|
||||||
abort(404);
|
abort(404);
|
||||||
@@ -89,7 +90,7 @@ class EventJoinTokenController extends Controller
|
|||||||
|
|
||||||
public function destroy(Request $request, Event $event, EventJoinToken $joinToken): EventJoinTokenResource
|
public function destroy(Request $request, Event $event, EventJoinToken $joinToken): EventJoinTokenResource
|
||||||
{
|
{
|
||||||
$this->authorizeEvent($request, $event);
|
$this->authorizeEvent($request, $event, 'join-tokens:manage');
|
||||||
|
|
||||||
if ($joinToken->event_id !== $event->id) {
|
if ($joinToken->event_id !== $event->id) {
|
||||||
abort(404);
|
abort(404);
|
||||||
@@ -101,13 +102,17 @@ class EventJoinTokenController extends Controller
|
|||||||
return new EventJoinTokenResource($token);
|
return new EventJoinTokenResource($token);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function authorizeEvent(Request $request, Event $event): void
|
private function authorizeEvent(Request $request, Event $event, ?string $permission = null): void
|
||||||
{
|
{
|
||||||
$tenantId = $request->attributes->get('tenant_id');
|
$tenantId = $request->attributes->get('tenant_id');
|
||||||
|
|
||||||
if ($event->tenant_id !== $tenantId) {
|
if ($event->tenant_id !== $tenantId) {
|
||||||
abort(404, 'Event not found');
|
abort(404, 'Event not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($permission) {
|
||||||
|
TenantMemberPermissions::ensureEventPermission($request, $event, $permission);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function validatePayload(Request $request, bool $partial = false): array
|
private function validatePayload(Request $request, bool $partial = false): array
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ use App\Http\Controllers\Controller;
|
|||||||
use App\Models\Event;
|
use App\Models\Event;
|
||||||
use App\Models\EventJoinToken;
|
use App\Models\EventJoinToken;
|
||||||
use App\Support\JoinTokenLayoutRegistry;
|
use App\Support\JoinTokenLayoutRegistry;
|
||||||
|
use App\Support\TenantMemberPermissions;
|
||||||
use Dompdf\Dompdf;
|
use Dompdf\Dompdf;
|
||||||
use Dompdf\Options;
|
use Dompdf\Options;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
@@ -28,6 +29,7 @@ class EventJoinTokenLayoutController extends Controller
|
|||||||
public function index(Request $request, Event $event, EventJoinToken $joinToken)
|
public function index(Request $request, Event $event, EventJoinToken $joinToken)
|
||||||
{
|
{
|
||||||
$this->ensureBelongsToEvent($event, $joinToken);
|
$this->ensureBelongsToEvent($event, $joinToken);
|
||||||
|
TenantMemberPermissions::ensureEventPermission($request, $event, 'join-tokens:manage');
|
||||||
|
|
||||||
$layouts = JoinTokenLayoutRegistry::toResponse(function (string $layoutId, string $format) use ($event, $joinToken) {
|
$layouts = JoinTokenLayoutRegistry::toResponse(function (string $layoutId, string $format) use ($event, $joinToken) {
|
||||||
return route('api.v1.tenant.events.join-tokens.layouts.download', [
|
return route('api.v1.tenant.events.join-tokens.layouts.download', [
|
||||||
@@ -46,6 +48,7 @@ class EventJoinTokenLayoutController extends Controller
|
|||||||
public function download(Request $request, Event $event, EventJoinToken $joinToken, string $layout, string $format)
|
public function download(Request $request, Event $event, EventJoinToken $joinToken, string $layout, string $format)
|
||||||
{
|
{
|
||||||
$this->ensureBelongsToEvent($event, $joinToken);
|
$this->ensureBelongsToEvent($event, $joinToken);
|
||||||
|
TenantMemberPermissions::ensureEventPermission($request, $event, 'join-tokens:manage');
|
||||||
|
|
||||||
$layoutConfig = JoinTokenLayoutRegistry::find($layout);
|
$layoutConfig = JoinTokenLayoutRegistry::find($layout);
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ use App\Models\Event;
|
|||||||
use App\Models\EventMember;
|
use App\Models\EventMember;
|
||||||
use App\Models\Tenant;
|
use App\Models\Tenant;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
use App\Support\TenantMemberPermissions;
|
||||||
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
|
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
|
||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
@@ -22,6 +23,7 @@ class EventMemberController extends Controller
|
|||||||
public function index(Request $request, Event $event): JsonResponse
|
public function index(Request $request, Event $event): JsonResponse
|
||||||
{
|
{
|
||||||
$this->assertEventTenant($request, $event);
|
$this->assertEventTenant($request, $event);
|
||||||
|
TenantMemberPermissions::ensureEventPermission($request, $event, 'members:manage');
|
||||||
|
|
||||||
/** @var LengthAwarePaginator $members */
|
/** @var LengthAwarePaginator $members */
|
||||||
$members = $event->members()
|
$members = $event->members()
|
||||||
@@ -34,6 +36,7 @@ class EventMemberController extends Controller
|
|||||||
public function store(EventMemberInviteRequest $request, Event $event): JsonResponse
|
public function store(EventMemberInviteRequest $request, Event $event): JsonResponse
|
||||||
{
|
{
|
||||||
$this->assertEventTenant($request, $event);
|
$this->assertEventTenant($request, $event);
|
||||||
|
TenantMemberPermissions::ensureEventPermission($request, $event, 'members:manage');
|
||||||
|
|
||||||
$data = $request->validated();
|
$data = $request->validated();
|
||||||
$tenant = $this->resolveTenantFromRequest($request);
|
$tenant = $this->resolveTenantFromRequest($request);
|
||||||
@@ -92,6 +95,7 @@ class EventMemberController extends Controller
|
|||||||
public function destroy(Request $request, Event $event, EventMember $member): JsonResponse
|
public function destroy(Request $request, Event $event, EventMember $member): JsonResponse
|
||||||
{
|
{
|
||||||
$this->assertEventTenant($request, $event);
|
$this->assertEventTenant($request, $event);
|
||||||
|
TenantMemberPermissions::ensureEventPermission($request, $event, 'members:manage');
|
||||||
|
|
||||||
if ((int) $member->event_id !== (int) $event->id) {
|
if ((int) $member->event_id !== (int) $event->id) {
|
||||||
throw ValidationException::withMessages([
|
throw ValidationException::withMessages([
|
||||||
|
|||||||
@@ -112,4 +112,3 @@ class FontController extends Controller
|
|||||||
return $fonts;
|
return $fonts;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ namespace App\Http\Controllers\Api\Tenant;
|
|||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Models\Event;
|
use App\Models\Event;
|
||||||
|
use App\Support\TenantMemberPermissions;
|
||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use SimpleSoftwareIO\QrCode\Facades\QrCode;
|
use SimpleSoftwareIO\QrCode\Facades\QrCode;
|
||||||
@@ -13,6 +14,7 @@ class LiveShowLinkController extends Controller
|
|||||||
public function show(Request $request, Event $event): JsonResponse
|
public function show(Request $request, Event $event): JsonResponse
|
||||||
{
|
{
|
||||||
$this->authorizeEvent($request, $event);
|
$this->authorizeEvent($request, $event);
|
||||||
|
TenantMemberPermissions::ensureEventPermission($request, $event, 'live-show:manage');
|
||||||
|
|
||||||
$token = $event->ensureLiveShowToken();
|
$token = $event->ensureLiveShowToken();
|
||||||
|
|
||||||
@@ -24,6 +26,7 @@ class LiveShowLinkController extends Controller
|
|||||||
public function rotate(Request $request, Event $event): JsonResponse
|
public function rotate(Request $request, Event $event): JsonResponse
|
||||||
{
|
{
|
||||||
$this->authorizeEvent($request, $event);
|
$this->authorizeEvent($request, $event);
|
||||||
|
TenantMemberPermissions::ensureEventPermission($request, $event, 'live-show:manage');
|
||||||
|
|
||||||
$token = $event->rotateLiveShowToken();
|
$token = $event->rotateLiveShowToken();
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ use App\Http\Resources\Tenant\PhotoResource;
|
|||||||
use App\Models\Event;
|
use App\Models\Event;
|
||||||
use App\Models\Photo;
|
use App\Models\Photo;
|
||||||
use App\Support\ApiError;
|
use App\Support\ApiError;
|
||||||
|
use App\Support\TenantMemberPermissions;
|
||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Http\Resources\Json\AnonymousResourceCollection;
|
use Illuminate\Http\Resources\Json\AnonymousResourceCollection;
|
||||||
@@ -23,6 +24,7 @@ class LiveShowPhotoController extends Controller
|
|||||||
$event = Event::where('slug', $eventSlug)
|
$event = Event::where('slug', $eventSlug)
|
||||||
->where('tenant_id', $tenantId)
|
->where('tenant_id', $tenantId)
|
||||||
->firstOrFail();
|
->firstOrFail();
|
||||||
|
TenantMemberPermissions::ensureEventPermission($request, $event, 'photos:moderate');
|
||||||
|
|
||||||
$liveStatus = $request->string('live_status', 'pending')->toString();
|
$liveStatus = $request->string('live_status', 'pending')->toString();
|
||||||
$perPage = (int) $request->input('per_page', 20);
|
$perPage = (int) $request->input('per_page', 20);
|
||||||
@@ -51,6 +53,7 @@ class LiveShowPhotoController extends Controller
|
|||||||
$event = Event::where('slug', $eventSlug)
|
$event = Event::where('slug', $eventSlug)
|
||||||
->where('tenant_id', $tenantId)
|
->where('tenant_id', $tenantId)
|
||||||
->firstOrFail();
|
->firstOrFail();
|
||||||
|
TenantMemberPermissions::ensureEventPermission($request, $event, 'photos:moderate');
|
||||||
|
|
||||||
if ($photo->event_id !== $event->id) {
|
if ($photo->event_id !== $event->id) {
|
||||||
return ApiError::response(
|
return ApiError::response(
|
||||||
@@ -94,6 +97,7 @@ class LiveShowPhotoController extends Controller
|
|||||||
$event = Event::where('slug', $eventSlug)
|
$event = Event::where('slug', $eventSlug)
|
||||||
->where('tenant_id', $tenantId)
|
->where('tenant_id', $tenantId)
|
||||||
->firstOrFail();
|
->firstOrFail();
|
||||||
|
TenantMemberPermissions::ensureEventPermission($request, $event, 'photos:moderate');
|
||||||
|
|
||||||
if ($photo->event_id !== $event->id) {
|
if ($photo->event_id !== $event->id) {
|
||||||
return ApiError::response(
|
return ApiError::response(
|
||||||
@@ -146,6 +150,7 @@ class LiveShowPhotoController extends Controller
|
|||||||
$event = Event::where('slug', $eventSlug)
|
$event = Event::where('slug', $eventSlug)
|
||||||
->where('tenant_id', $tenantId)
|
->where('tenant_id', $tenantId)
|
||||||
->firstOrFail();
|
->firstOrFail();
|
||||||
|
TenantMemberPermissions::ensureEventPermission($request, $event, 'photos:moderate');
|
||||||
|
|
||||||
if ($photo->event_id !== $event->id) {
|
if ($photo->event_id !== $event->id) {
|
||||||
return ApiError::response(
|
return ApiError::response(
|
||||||
@@ -173,6 +178,7 @@ class LiveShowPhotoController extends Controller
|
|||||||
$event = Event::where('slug', $eventSlug)
|
$event = Event::where('slug', $eventSlug)
|
||||||
->where('tenant_id', $tenantId)
|
->where('tenant_id', $tenantId)
|
||||||
->firstOrFail();
|
->firstOrFail();
|
||||||
|
TenantMemberPermissions::ensureEventPermission($request, $event, 'photos:moderate');
|
||||||
|
|
||||||
if ($photo->event_id !== $event->id) {
|
if ($photo->event_id !== $event->id) {
|
||||||
return ApiError::response(
|
return ApiError::response(
|
||||||
|
|||||||
@@ -14,11 +14,13 @@ use App\Services\Packages\PackageUsageTracker;
|
|||||||
use App\Services\Storage\EventStorageManager;
|
use App\Services\Storage\EventStorageManager;
|
||||||
use App\Support\ApiError;
|
use App\Support\ApiError;
|
||||||
use App\Support\ImageHelper;
|
use App\Support\ImageHelper;
|
||||||
|
use App\Support\TenantMemberPermissions;
|
||||||
use App\Support\UploadStream;
|
use App\Support\UploadStream;
|
||||||
use App\Support\WatermarkConfigResolver;
|
use App\Support\WatermarkConfigResolver;
|
||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Http\Resources\Json\AnonymousResourceCollection;
|
use Illuminate\Http\Resources\Json\AnonymousResourceCollection;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
@@ -130,6 +132,11 @@ class PhotoController extends Controller
|
|||||||
|
|
||||||
$photo->status = $validated['visible'] ? 'approved' : 'hidden';
|
$photo->status = $validated['visible'] ? 'approved' : 'hidden';
|
||||||
$photo->save();
|
$photo->save();
|
||||||
|
|
||||||
|
$autoRemoveLiveOnHide = (bool) Arr::get($event->settings ?? [], 'control_room.auto_remove_live_on_hide', true);
|
||||||
|
if ($autoRemoveLiveOnHide && ! $validated['visible']) {
|
||||||
|
$photo->rejectForLiveShow($request->user(), 'hidden');
|
||||||
|
}
|
||||||
$photo->load('event')->loadCount('likes');
|
$photo->load('event')->loadCount('likes');
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
@@ -524,19 +531,17 @@ class PhotoController extends Controller
|
|||||||
'alt_text' => ['sometimes', 'string', 'max:255'],
|
'alt_text' => ['sometimes', 'string', 'max:255'],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Only tenant admins can moderate
|
if (isset($validated['status'])) {
|
||||||
if (isset($validated['status']) && ! $this->tokenHasScope($request, 'tenant-admin')) {
|
TenantMemberPermissions::ensureEventPermission($request, $event, 'photos:moderate');
|
||||||
return ApiError::response(
|
|
||||||
'insufficient_scope',
|
|
||||||
'Insufficient Scopes',
|
|
||||||
'You are not allowed to moderate photos for this event.',
|
|
||||||
Response::HTTP_FORBIDDEN,
|
|
||||||
['required_scope' => 'tenant-admin']
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$photo->update($validated);
|
$photo->update($validated);
|
||||||
|
|
||||||
|
$autoRemoveLiveOnHide = (bool) Arr::get($event->settings ?? [], 'control_room.auto_remove_live_on_hide', true);
|
||||||
|
if ($autoRemoveLiveOnHide && ($validated['status'] ?? null) === 'rejected') {
|
||||||
|
$photo->rejectForLiveShow($request->user());
|
||||||
|
}
|
||||||
|
|
||||||
if ($validated['status'] ?? null === 'approved') {
|
if ($validated['status'] ?? null === 'approved') {
|
||||||
$photo->load('event')->loadCount('likes');
|
$photo->load('event')->loadCount('likes');
|
||||||
// Trigger event for new photo notification
|
// Trigger event for new photo notification
|
||||||
@@ -634,6 +639,7 @@ class PhotoController extends Controller
|
|||||||
$event = Event::where('slug', $eventSlug)
|
$event = Event::where('slug', $eventSlug)
|
||||||
->where('tenant_id', $tenantId)
|
->where('tenant_id', $tenantId)
|
||||||
->firstOrFail();
|
->firstOrFail();
|
||||||
|
TenantMemberPermissions::ensureEventPermission($request, $event, 'photos:moderate');
|
||||||
|
|
||||||
if ($photo->event_id !== $event->id) {
|
if ($photo->event_id !== $event->id) {
|
||||||
return ApiError::response(
|
return ApiError::response(
|
||||||
@@ -657,6 +663,7 @@ class PhotoController extends Controller
|
|||||||
$event = Event::where('slug', $eventSlug)
|
$event = Event::where('slug', $eventSlug)
|
||||||
->where('tenant_id', $tenantId)
|
->where('tenant_id', $tenantId)
|
||||||
->firstOrFail();
|
->firstOrFail();
|
||||||
|
TenantMemberPermissions::ensureEventPermission($request, $event, 'photos:moderate');
|
||||||
|
|
||||||
if ($photo->event_id !== $event->id) {
|
if ($photo->event_id !== $event->id) {
|
||||||
return ApiError::response(
|
return ApiError::response(
|
||||||
@@ -680,6 +687,7 @@ class PhotoController extends Controller
|
|||||||
$event = Event::where('slug', $eventSlug)
|
$event = Event::where('slug', $eventSlug)
|
||||||
->where('tenant_id', $tenantId)
|
->where('tenant_id', $tenantId)
|
||||||
->firstOrFail();
|
->firstOrFail();
|
||||||
|
TenantMemberPermissions::ensureEventPermission($request, $event, 'photos:moderate');
|
||||||
|
|
||||||
$request->validate([
|
$request->validate([
|
||||||
'photo_ids' => 'required|array',
|
'photo_ids' => 'required|array',
|
||||||
@@ -725,6 +733,7 @@ class PhotoController extends Controller
|
|||||||
$event = Event::where('slug', $eventSlug)
|
$event = Event::where('slug', $eventSlug)
|
||||||
->where('tenant_id', $tenantId)
|
->where('tenant_id', $tenantId)
|
||||||
->firstOrFail();
|
->firstOrFail();
|
||||||
|
TenantMemberPermissions::ensureEventPermission($request, $event, 'photos:moderate');
|
||||||
|
|
||||||
$request->validate([
|
$request->validate([
|
||||||
'photo_ids' => 'required|array',
|
'photo_ids' => 'required|array',
|
||||||
|
|||||||
@@ -3,12 +3,17 @@
|
|||||||
namespace App\Http\Controllers\Api\Tenant;
|
namespace App\Http\Controllers\Api\Tenant;
|
||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Http\Requests\Photobooth\PhotoboothSendUploaderDownloadRequest;
|
||||||
use App\Http\Resources\Tenant\PhotoboothStatusResource;
|
use App\Http\Resources\Tenant\PhotoboothStatusResource;
|
||||||
|
use App\Mail\PhotoboothUploaderDownload;
|
||||||
use App\Models\Event;
|
use App\Models\Event;
|
||||||
use App\Models\PhotoboothSetting;
|
use App\Models\PhotoboothSetting;
|
||||||
use App\Services\Photobooth\PhotoboothProvisioner;
|
use App\Services\Photobooth\PhotoboothProvisioner;
|
||||||
|
use App\Support\LocaleConfig;
|
||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Mail;
|
||||||
|
use Illuminate\Validation\ValidationException;
|
||||||
|
|
||||||
class PhotoboothController extends Controller
|
class PhotoboothController extends Controller
|
||||||
{
|
{
|
||||||
@@ -69,6 +74,39 @@ class PhotoboothController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function sendUploaderDownloadEmail(PhotoboothSendUploaderDownloadRequest $request, Event $event): JsonResponse
|
||||||
|
{
|
||||||
|
$this->assertEventBelongsToTenant($request, $event);
|
||||||
|
|
||||||
|
$user = $request->user();
|
||||||
|
|
||||||
|
if (! $user || ! $user->email) {
|
||||||
|
throw ValidationException::withMessages([
|
||||||
|
'email' => __('No email address is configured for this account.'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$locale = LocaleConfig::canonicalize($user->preferred_locale ?: app()->getLocale());
|
||||||
|
$eventName = $this->resolveEventName($event, $locale);
|
||||||
|
$recipientName = $user->fullName ?? $user->name ?? $user->email;
|
||||||
|
|
||||||
|
$mail = (new PhotoboothUploaderDownload(
|
||||||
|
recipientName: $recipientName,
|
||||||
|
eventName: $eventName,
|
||||||
|
links: [
|
||||||
|
'windows' => url('/downloads/PhotoboothUploader-win-x64.exe'),
|
||||||
|
'macos' => url('/downloads/PhotoboothUploader-macos-x64'),
|
||||||
|
'linux' => url('/downloads/PhotoboothUploader-linux-x64'),
|
||||||
|
],
|
||||||
|
))->locale($locale);
|
||||||
|
|
||||||
|
Mail::to($user->email)->queue($mail);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => __('Download links sent via email.'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
protected function resource(Event $event): PhotoboothStatusResource
|
protected function resource(Event $event): PhotoboothStatusResource
|
||||||
{
|
{
|
||||||
return PhotoboothStatusResource::make([
|
return PhotoboothStatusResource::make([
|
||||||
@@ -92,4 +130,30 @@ class PhotoboothController extends Controller
|
|||||||
|
|
||||||
return in_array($mode, ['sparkbooth', 'ftp'], true) ? $mode : 'ftp';
|
return in_array($mode, ['sparkbooth', 'ftp'], true) ? $mode : 'ftp';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function resolveEventName(Event $event, ?string $locale = null): string
|
||||||
|
{
|
||||||
|
$name = $event->name;
|
||||||
|
|
||||||
|
if (is_string($name) && trim($name) !== '') {
|
||||||
|
return $name;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_array($name)) {
|
||||||
|
$locale = $locale ?: app()->getLocale();
|
||||||
|
$localized = $name[$locale] ?? null;
|
||||||
|
|
||||||
|
if (is_string($localized) && trim($localized) !== '') {
|
||||||
|
return $localized;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($name as $value) {
|
||||||
|
if (is_string($value) && trim($value) !== '') {
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $event->slug ?: __('emails.photobooth_uploader.event_fallback');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -113,8 +113,8 @@ class SettingsController extends Controller
|
|||||||
$defaultSettings = [
|
$defaultSettings = [
|
||||||
'branding' => [
|
'branding' => [
|
||||||
'logo_url' => null,
|
'logo_url' => null,
|
||||||
'primary_color' => '#3B82F6',
|
'primary_color' => '#FF5A5F',
|
||||||
'secondary_color' => '#1F2937',
|
'secondary_color' => '#FFF8F5',
|
||||||
'font_family' => 'Inter, sans-serif',
|
'font_family' => 'Inter, sans-serif',
|
||||||
],
|
],
|
||||||
'features' => [
|
'features' => [
|
||||||
|
|||||||
@@ -110,6 +110,7 @@ class TaskCollectionController extends Controller
|
|||||||
),
|
),
|
||||||
'created_task_ids' => $result['created_task_ids'],
|
'created_task_ids' => $result['created_task_ids'],
|
||||||
'attached_task_ids' => $result['attached_task_ids'],
|
'attached_task_ids' => $result['attached_task_ids'],
|
||||||
|
'skipped_task_ids' => $result['skipped_task_ids'],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,9 @@ use App\Models\Event;
|
|||||||
use App\Models\Task;
|
use App\Models\Task;
|
||||||
use App\Models\TaskCollection;
|
use App\Models\TaskCollection;
|
||||||
use App\Models\Tenant;
|
use App\Models\Tenant;
|
||||||
|
use App\Services\Packages\PackageLimitEvaluator;
|
||||||
use App\Support\ApiError;
|
use App\Support\ApiError;
|
||||||
|
use App\Support\TenantMemberPermissions;
|
||||||
use App\Support\TenantRequestResolver;
|
use App\Support\TenantRequestResolver;
|
||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
@@ -19,6 +21,8 @@ use Symfony\Component\HttpFoundation\Response;
|
|||||||
|
|
||||||
class TaskController extends Controller
|
class TaskController extends Controller
|
||||||
{
|
{
|
||||||
|
public function __construct(private readonly PackageLimitEvaluator $packageLimitEvaluator) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display a listing of the tenant's tasks.
|
* Display a listing of the tenant's tasks.
|
||||||
*/
|
*/
|
||||||
@@ -66,6 +70,8 @@ class TaskController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function store(TaskStoreRequest $request): JsonResponse
|
public function store(TaskStoreRequest $request): JsonResponse
|
||||||
{
|
{
|
||||||
|
TenantMemberPermissions::ensureTenantPermission($request, 'tasks:manage');
|
||||||
|
|
||||||
$tenant = $this->currentTenant($request);
|
$tenant = $this->currentTenant($request);
|
||||||
$collectionId = $request->input('collection_id');
|
$collectionId = $request->input('collection_id');
|
||||||
$collection = $collectionId ? $this->resolveAccessibleCollection($request, $collectionId) : null;
|
$collection = $collectionId ? $this->resolveAccessibleCollection($request, $collectionId) : null;
|
||||||
@@ -107,6 +113,8 @@ class TaskController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function update(TaskUpdateRequest $request, Task $task): JsonResponse
|
public function update(TaskUpdateRequest $request, Task $task): JsonResponse
|
||||||
{
|
{
|
||||||
|
TenantMemberPermissions::ensureTenantPermission($request, 'tasks:manage');
|
||||||
|
|
||||||
$tenant = $this->currentTenant($request);
|
$tenant = $this->currentTenant($request);
|
||||||
|
|
||||||
if ($task->tenant_id !== $tenant->id) {
|
if ($task->tenant_id !== $tenant->id) {
|
||||||
@@ -138,6 +146,8 @@ class TaskController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function destroy(Request $request, Task $task): JsonResponse
|
public function destroy(Request $request, Task $task): JsonResponse
|
||||||
{
|
{
|
||||||
|
TenantMemberPermissions::ensureTenantPermission($request, 'tasks:manage');
|
||||||
|
|
||||||
if ($task->tenant_id !== $this->currentTenant($request)->id) {
|
if ($task->tenant_id !== $this->currentTenant($request)->id) {
|
||||||
abort(404, 'Task nicht gefunden.');
|
abort(404, 'Task nicht gefunden.');
|
||||||
}
|
}
|
||||||
@@ -154,7 +164,10 @@ class TaskController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function assignToEvent(Request $request, Task $task, Event $event): JsonResponse
|
public function assignToEvent(Request $request, Task $task, Event $event): JsonResponse
|
||||||
{
|
{
|
||||||
$tenantId = $this->currentTenant($request)->id;
|
TenantMemberPermissions::ensureEventPermission($request, $event, 'tasks:manage');
|
||||||
|
|
||||||
|
$tenant = $this->currentTenant($request);
|
||||||
|
$tenantId = $tenant->id;
|
||||||
|
|
||||||
if (($task->tenant_id && $task->tenant_id !== $tenantId) || $event->tenant_id !== $tenantId) {
|
if (($task->tenant_id && $task->tenant_id !== $tenantId) || $event->tenant_id !== $tenantId) {
|
||||||
abort(404);
|
abort(404);
|
||||||
@@ -164,6 +177,11 @@ class TaskController extends Controller
|
|||||||
return response()->json(['message' => 'Task ist bereits diesem Event zugewiesen.'], 409);
|
return response()->json(['message' => 'Task ist bereits diesem Event zugewiesen.'], 409);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$limitStatus = $this->resolveTaskLimitStatus($event, $tenant);
|
||||||
|
if ($limitStatus['remaining'] !== null && $limitStatus['remaining'] <= 0) {
|
||||||
|
return $this->taskLimitExceededResponse($event, $limitStatus);
|
||||||
|
}
|
||||||
|
|
||||||
$task->assignedEvents()->attach($event->id);
|
$task->assignedEvents()->attach($event->id);
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
@@ -176,7 +194,10 @@ class TaskController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function bulkAssignToEvent(Request $request, Event $event): JsonResponse
|
public function bulkAssignToEvent(Request $request, Event $event): JsonResponse
|
||||||
{
|
{
|
||||||
$tenantId = $this->currentTenant($request)->id;
|
TenantMemberPermissions::ensureEventPermission($request, $event, 'tasks:manage');
|
||||||
|
|
||||||
|
$tenant = $this->currentTenant($request);
|
||||||
|
$tenantId = $tenant->id;
|
||||||
|
|
||||||
if ($event->tenant_id !== $tenantId) {
|
if ($event->tenant_id !== $tenantId) {
|
||||||
abort(404);
|
abort(404);
|
||||||
@@ -192,12 +213,27 @@ class TaskController extends Controller
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$taskIds = array_values(array_unique(array_map('intval', $taskIds)));
|
||||||
$tasks = Task::whereIn('id', $taskIds)
|
$tasks = Task::whereIn('id', $taskIds)
|
||||||
->where(function ($query) use ($tenantId) {
|
->where(function ($query) use ($tenantId) {
|
||||||
$query->whereNull('tenant_id')->orWhere('tenant_id', $tenantId);
|
$query->whereNull('tenant_id')->orWhere('tenant_id', $tenantId);
|
||||||
})
|
})
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
|
$assignedIds = $event->tasks()
|
||||||
|
->whereIn('tasks.id', $taskIds)
|
||||||
|
->pluck('tasks.id')
|
||||||
|
->all();
|
||||||
|
$pendingIds = array_values(array_diff($taskIds, $assignedIds));
|
||||||
|
$limitStatus = $this->resolveTaskLimitStatus($event, $tenant);
|
||||||
|
if (
|
||||||
|
$limitStatus['remaining'] !== null
|
||||||
|
&& $pendingIds !== []
|
||||||
|
&& $limitStatus['remaining'] < count($pendingIds)
|
||||||
|
) {
|
||||||
|
return $this->taskLimitExceededResponse($event, $limitStatus);
|
||||||
|
}
|
||||||
|
|
||||||
$attached = 0;
|
$attached = 0;
|
||||||
foreach ($tasks as $task) {
|
foreach ($tasks as $task) {
|
||||||
if (! $task->assignedEvents()->where('event_id', $event->id)->exists()) {
|
if (! $task->assignedEvents()->where('event_id', $event->id)->exists()) {
|
||||||
@@ -230,6 +266,8 @@ class TaskController extends Controller
|
|||||||
|
|
||||||
public function bulkDetachFromEvent(Request $request, Event $event): JsonResponse
|
public function bulkDetachFromEvent(Request $request, Event $event): JsonResponse
|
||||||
{
|
{
|
||||||
|
TenantMemberPermissions::ensureEventPermission($request, $event, 'tasks:manage');
|
||||||
|
|
||||||
$tenantId = $this->currentTenant($request)->id;
|
$tenantId = $this->currentTenant($request)->id;
|
||||||
|
|
||||||
if ($event->tenant_id !== $tenantId) {
|
if ($event->tenant_id !== $tenantId) {
|
||||||
@@ -256,6 +294,8 @@ class TaskController extends Controller
|
|||||||
|
|
||||||
public function reorderForEvent(Request $request, Event $event): JsonResponse
|
public function reorderForEvent(Request $request, Event $event): JsonResponse
|
||||||
{
|
{
|
||||||
|
TenantMemberPermissions::ensureEventPermission($request, $event, 'tasks:manage');
|
||||||
|
|
||||||
$tenantId = $this->currentTenant($request)->id;
|
$tenantId = $this->currentTenant($request)->id;
|
||||||
|
|
||||||
if ($event->tenant_id !== $tenantId) {
|
if ($event->tenant_id !== $tenantId) {
|
||||||
@@ -315,6 +355,52 @@ class TaskController extends Controller
|
|||||||
return TenantRequestResolver::resolve($request);
|
return TenantRequestResolver::resolve($request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array{limit: ?int, used: int, remaining: ?int, package_id: ?int}
|
||||||
|
*/
|
||||||
|
protected function resolveTaskLimitStatus(Event $event, Tenant $tenant): array
|
||||||
|
{
|
||||||
|
$event->loadMissing(['eventPackage.package', 'eventPackages.package']);
|
||||||
|
|
||||||
|
$eventPackage = $this->packageLimitEvaluator->resolveEventPackageForPhotoUpload(
|
||||||
|
$tenant,
|
||||||
|
$event->id,
|
||||||
|
$event
|
||||||
|
);
|
||||||
|
|
||||||
|
$limit = $eventPackage?->effectiveLimits()['max_tasks'] ?? null;
|
||||||
|
$used = $event->tasks()->count();
|
||||||
|
$remaining = $limit === null ? null : max(0, (int) $limit - $used);
|
||||||
|
|
||||||
|
return [
|
||||||
|
'limit' => $limit === null ? null : (int) $limit,
|
||||||
|
'used' => $used,
|
||||||
|
'remaining' => $remaining,
|
||||||
|
'package_id' => $eventPackage?->package_id,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array{limit: ?int, used: int, remaining: ?int, package_id: ?int} $limitStatus
|
||||||
|
*/
|
||||||
|
protected function taskLimitExceededResponse(Event $event, array $limitStatus): JsonResponse
|
||||||
|
{
|
||||||
|
return ApiError::response(
|
||||||
|
'task_limit_exceeded',
|
||||||
|
__('api.packages.task_limit_exceeded.title'),
|
||||||
|
__('api.packages.task_limit_exceeded.message'),
|
||||||
|
Response::HTTP_PAYMENT_REQUIRED,
|
||||||
|
[
|
||||||
|
'scope' => 'tasks',
|
||||||
|
'used' => $limitStatus['used'],
|
||||||
|
'limit' => $limitStatus['limit'],
|
||||||
|
'remaining' => $limitStatus['remaining'] ?? 0,
|
||||||
|
'event_id' => $event->id,
|
||||||
|
'package_id' => $limitStatus['package_id'],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
protected function prepareTaskPayload(array $data, int $tenantId, ?Task $original = null): array
|
protected function prepareTaskPayload(array $data, int $tenantId, ?Task $original = null): array
|
||||||
{
|
{
|
||||||
if (array_key_exists('title', $data)) {
|
if (array_key_exists('title', $data)) {
|
||||||
|
|||||||
@@ -39,7 +39,9 @@ class TenantPackageController extends Controller
|
|||||||
|
|
||||||
$activePackage = $tenant->activeResellerPackage?->load('package');
|
$activePackage = $tenant->activeResellerPackage?->load('package');
|
||||||
|
|
||||||
if ($activePackage instanceof TenantPackage) {
|
if (! ($activePackage instanceof TenantPackage)) {
|
||||||
|
$activePackage = $packages->firstWhere('active', true);
|
||||||
|
} else {
|
||||||
$this->hydratePackageSnapshot($activePackage, $usageEventPackage);
|
$this->hydratePackageSnapshot($activePackage, $usageEventPackage);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,6 +62,7 @@ class TenantPackageController extends Controller
|
|||||||
$pkg?->limits ?? [],
|
$pkg?->limits ?? [],
|
||||||
$this->buildUsageSnapshot($eventPackage),
|
$this->buildUsageSnapshot($eventPackage),
|
||||||
[
|
[
|
||||||
|
'included_package_slug' => $pkg?->included_package_slug,
|
||||||
'branding_allowed' => $pkg?->branding_allowed,
|
'branding_allowed' => $pkg?->branding_allowed,
|
||||||
'watermark_allowed' => $pkg?->watermark_allowed,
|
'watermark_allowed' => $pkg?->watermark_allowed,
|
||||||
'features' => $pkg?->features ?? [],
|
'features' => $pkg?->features ?? [],
|
||||||
|
|||||||
@@ -47,6 +47,15 @@ class AuthenticatedSessionController extends Controller
|
|||||||
|
|
||||||
$user = Auth::user();
|
$user = Auth::user();
|
||||||
if ($user && $user->email_verified_at === null) {
|
if ($user && $user->email_verified_at === null) {
|
||||||
|
$intended = $request->session()->get('url.intended');
|
||||||
|
$intended = is_string($intended) ? trim($intended) : null;
|
||||||
|
|
||||||
|
if ($this->isVerificationLink($intended)) {
|
||||||
|
$request->session()->forget('url.intended');
|
||||||
|
|
||||||
|
return Inertia::location($intended);
|
||||||
|
}
|
||||||
|
|
||||||
return Inertia::location(route('verification.notice'));
|
return Inertia::location(route('verification.notice'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,6 +125,29 @@ class AuthenticatedSessionController extends Controller
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function isVerificationLink(?string $target): bool
|
||||||
|
{
|
||||||
|
if (! is_string($target) || trim($target) === '') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$path = trim($target);
|
||||||
|
|
||||||
|
if (str_starts_with($path, '/verify-email/')) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$parsed = parse_url($path);
|
||||||
|
|
||||||
|
if ($parsed === false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$path = $parsed['path'] ?? '';
|
||||||
|
|
||||||
|
return $path !== '' && str_starts_with($path, '/verify-email/');
|
||||||
|
}
|
||||||
|
|
||||||
private function decodeReturnTo(string $value, Request $request): ?string
|
private function decodeReturnTo(string $value, Request $request): ?string
|
||||||
{
|
{
|
||||||
$candidate = $this->decodeBase64Url($value) ?? $value;
|
$candidate = $this->decodeBase64Url($value) ?? $value;
|
||||||
|
|||||||
@@ -108,8 +108,8 @@ class CheckoutController extends Controller
|
|||||||
'settings' => json_encode([
|
'settings' => json_encode([
|
||||||
'branding' => [
|
'branding' => [
|
||||||
'logo_url' => null,
|
'logo_url' => null,
|
||||||
'primary_color' => '#3B82F6',
|
'primary_color' => '#FF5A5F',
|
||||||
'secondary_color' => '#1F2937',
|
'secondary_color' => '#FFF8F5',
|
||||||
'font_family' => 'Inter, sans-serif',
|
'font_family' => 'Inter, sans-serif',
|
||||||
],
|
],
|
||||||
'features' => [
|
'features' => [
|
||||||
|
|||||||
@@ -146,8 +146,8 @@ class CheckoutGoogleController extends Controller
|
|||||||
'settings' => json_encode([
|
'settings' => json_encode([
|
||||||
'branding' => [
|
'branding' => [
|
||||||
'logo_url' => null,
|
'logo_url' => null,
|
||||||
'primary_color' => '#3B82F6',
|
'primary_color' => '#FF5A5F',
|
||||||
'secondary_color' => '#1F2937',
|
'secondary_color' => '#FFF8F5',
|
||||||
'font_family' => 'Inter, sans-serif',
|
'font_family' => 'Inter, sans-serif',
|
||||||
],
|
],
|
||||||
'features' => [
|
'features' => [
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ class LegalPageController extends Controller
|
|||||||
$effectiveFrom = optional($page->effective_from);
|
$effectiveFrom = optional($page->effective_from);
|
||||||
|
|
||||||
return Inertia::render('legal/Show', [
|
return Inertia::render('legal/Show', [
|
||||||
'seoTitle' => $title . ' - ' . config('app.name', 'Fotospiel'),
|
'seoTitle' => $title.' - '.config('app.name', 'Fotospiel'),
|
||||||
'title' => $title,
|
'title' => $title,
|
||||||
'content' => $this->convertMarkdownToHtml($bodyMarkdown),
|
'content' => $this->convertMarkdownToHtml($bodyMarkdown),
|
||||||
'effectiveFrom' => $effectiveFrom ? $effectiveFrom->toDateString() : null,
|
'effectiveFrom' => $effectiveFrom ? $effectiveFrom->toDateString() : null,
|
||||||
@@ -112,11 +112,11 @@ class LegalPageController extends Controller
|
|||||||
'allow_unsafe_links' => false,
|
'allow_unsafe_links' => false,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$environment->addExtension(new CommonMarkCoreExtension());
|
$environment->addExtension(new CommonMarkCoreExtension);
|
||||||
$environment->addExtension(new TableExtension());
|
$environment->addExtension(new TableExtension);
|
||||||
$environment->addExtension(new AutolinkExtension());
|
$environment->addExtension(new AutolinkExtension);
|
||||||
$environment->addExtension(new StrikethroughExtension());
|
$environment->addExtension(new StrikethroughExtension);
|
||||||
$environment->addExtension(new TaskListExtension());
|
$environment->addExtension(new TaskListExtension);
|
||||||
|
|
||||||
$converter = new MarkdownConverter($environment);
|
$converter = new MarkdownConverter($environment);
|
||||||
|
|
||||||
|
|||||||
@@ -409,10 +409,17 @@ class MarketingController extends Controller
|
|||||||
|
|
||||||
public function demo()
|
public function demo()
|
||||||
{
|
{
|
||||||
$joinToken = optional(Event::firstWhere('slug', 'demo-wedding-2025'))
|
$event = Event::query()
|
||||||
?->joinTokens()
|
->where('settings->marketing_demo', true)
|
||||||
->latest('id')
|
->latest('id')
|
||||||
->first();
|
->first();
|
||||||
|
$joinToken = null;
|
||||||
|
|
||||||
|
if ($event) {
|
||||||
|
$joinToken = $event->joinTokens()
|
||||||
|
->latest('id')
|
||||||
|
->first();
|
||||||
|
}
|
||||||
|
|
||||||
$demoToken = null;
|
$demoToken = null;
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ class EventPhotoArchiveController extends Controller
|
|||||||
abort(404, 'No approved photos available for this event.');
|
abort(404, 'No approved photos available for this event.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$zip = new ZipArchive();
|
$zip = new ZipArchive;
|
||||||
$tempPath = tempnam(sys_get_temp_dir(), 'fotospiel-photos-');
|
$tempPath = tempnam(sys_get_temp_dir(), 'fotospiel-photos-');
|
||||||
|
|
||||||
if ($tempPath === false || $zip->open($tempPath, ZipArchive::CREATE | ZipArchive::OVERWRITE) !== true) {
|
if ($tempPath === false || $zip->open($tempPath, ZipArchive::CREATE | ZipArchive::OVERWRITE) !== true) {
|
||||||
@@ -129,4 +129,3 @@ class EventPhotoArchiveController extends Controller
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -58,8 +58,8 @@ class TestGuestEventController extends Controller
|
|||||||
'date' => ($validated['date'] ?? Carbon::now()->addWeeks(2)->toDateString()),
|
'date' => ($validated['date'] ?? Carbon::now()->addWeeks(2)->toDateString()),
|
||||||
'settings' => [
|
'settings' => [
|
||||||
'branding' => [
|
'branding' => [
|
||||||
'primary_color' => '#f43f5e',
|
'primary_color' => '#FF5A5F',
|
||||||
'secondary_color' => '#fb7185',
|
'secondary_color' => '#FFF8F5',
|
||||||
'font_family' => 'Inter, sans-serif',
|
'font_family' => 'Inter, sans-serif',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -28,7 +28,12 @@ class CreditCheckMiddleware
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($this->requiresCredits($request) && ! $this->shouldBypassCreditCheck($request, $tenant)) {
|
if ($this->requiresCredits($request) && ! $this->shouldBypassCreditCheck($request, $tenant)) {
|
||||||
$violation = $this->limitEvaluator->assessEventCreation($tenant);
|
$includedSlug = $request->input('service_package_slug');
|
||||||
|
|
||||||
|
$violation = $this->limitEvaluator->assessEventCreation(
|
||||||
|
$tenant,
|
||||||
|
is_string($includedSlug) && $includedSlug !== '' ? $includedSlug : null
|
||||||
|
);
|
||||||
|
|
||||||
if ($violation !== null) {
|
if ($violation !== null) {
|
||||||
return ApiError::response(
|
return ApiError::response(
|
||||||
|
|||||||
@@ -73,7 +73,12 @@ class PackageMiddleware
|
|||||||
private function detectViolation(Request $request, Tenant $tenant): ?array
|
private function detectViolation(Request $request, Tenant $tenant): ?array
|
||||||
{
|
{
|
||||||
if ($request->routeIs('api.v1.tenant.events.store')) {
|
if ($request->routeIs('api.v1.tenant.events.store')) {
|
||||||
return $this->limitEvaluator->assessEventCreation($tenant);
|
$includedSlug = $request->input('service_package_slug');
|
||||||
|
|
||||||
|
return $this->limitEvaluator->assessEventCreation(
|
||||||
|
$tenant,
|
||||||
|
is_string($includedSlug) && $includedSlug !== '' ? $includedSlug : null
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($request->routeIs('api.v1.tenant.events.photos.store')) {
|
if ($request->routeIs('api.v1.tenant.events.photos.store')) {
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class SetLocale
|
|||||||
$sessionLocale = Session::get('locale', 'de');
|
$sessionLocale = Session::get('locale', 'de');
|
||||||
|
|
||||||
// Fallback to Accept-Language header if no session
|
// Fallback to Accept-Language header if no session
|
||||||
if (!in_array($sessionLocale, $supportedLocales)) {
|
if (! in_array($sessionLocale, $supportedLocales)) {
|
||||||
$acceptLanguage = $request->header('Accept-Language', 'de');
|
$acceptLanguage = $request->header('Accept-Language', 'de');
|
||||||
$localeFromHeader = substr($acceptLanguage, 0, 2);
|
$localeFromHeader = substr($acceptLanguage, 0, 2);
|
||||||
$sessionLocale = in_array($localeFromHeader, $supportedLocales) ? $localeFromHeader : 'de';
|
$sessionLocale = in_array($localeFromHeader, $supportedLocales) ? $localeFromHeader : 'de';
|
||||||
|
|||||||
@@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
namespace App\Http\Middleware;
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use App\Support\LocaleConfig;
|
||||||
use Closure;
|
use Closure;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\App;
|
use Illuminate\Support\Facades\App;
|
||||||
use Illuminate\Support\Facades\Session;
|
use Illuminate\Support\Facades\Session;
|
||||||
use App\Support\LocaleConfig;
|
|
||||||
|
|
||||||
class SetLocaleFromRequest
|
class SetLocaleFromRequest
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -19,4 +19,3 @@ class SetLocaleFromUser
|
|||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Requests\Photobooth;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
|
class PhotoboothSendUploaderDownloadRequest extends FormRequest
|
||||||
|
{
|
||||||
|
public function authorize(): bool
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function rules(): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -57,8 +57,3 @@ class ProfileUpdateRequest extends FormRequest
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -23,14 +23,21 @@ class EventStoreRequest extends FormRequest
|
|||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
$tenantId = request()->attributes->get('tenant_id');
|
$tenantId = request()->attributes->get('tenant_id');
|
||||||
|
$creating = $this->isMethod('post');
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'name' => ['required', 'string', 'max:255'],
|
'name' => [$creating ? 'required' : 'sometimes', 'string', 'max:255'],
|
||||||
'description' => ['nullable', 'string'],
|
'description' => ['nullable', 'string'],
|
||||||
'event_date' => ['required', 'date', 'after_or_equal:today'],
|
'event_date' => $creating ? ['required', 'date', 'after_or_equal:today'] : ['sometimes', 'date'],
|
||||||
'location' => ['nullable', 'string', 'max:255'],
|
'location' => ['nullable', 'string', 'max:255'],
|
||||||
'event_type_id' => ['required', 'exists:event_types,id'],
|
'event_type_id' => [$creating ? 'required' : 'sometimes', 'exists:event_types,id'],
|
||||||
'package_id' => ['nullable', 'integer', 'exists:packages,id'],
|
'package_id' => ['nullable', 'integer', 'exists:packages,id'],
|
||||||
|
'service_package_slug' => [
|
||||||
|
'nullable',
|
||||||
|
'string',
|
||||||
|
'max:64',
|
||||||
|
Rule::exists('packages', 'slug')->where('type', 'endcustomer'),
|
||||||
|
],
|
||||||
'max_participants' => ['nullable', 'integer', 'min:1', 'max:10000'],
|
'max_participants' => ['nullable', 'integer', 'min:1', 'max:10000'],
|
||||||
'public_url' => ['nullable', 'url', 'max:500'],
|
'public_url' => ['nullable', 'url', 'max:500'],
|
||||||
'custom_domain' => ['nullable', 'string', 'max:255'],
|
'custom_domain' => ['nullable', 'string', 'max:255'],
|
||||||
@@ -43,9 +50,12 @@ class EventStoreRequest extends FormRequest
|
|||||||
'features' => ['nullable', 'array'],
|
'features' => ['nullable', 'array'],
|
||||||
'features.*' => ['string'],
|
'features.*' => ['string'],
|
||||||
'settings' => ['nullable', 'array'],
|
'settings' => ['nullable', 'array'],
|
||||||
|
'settings.location' => ['nullable', 'string', 'max:255'],
|
||||||
'settings.branding' => ['nullable', 'array'],
|
'settings.branding' => ['nullable', 'array'],
|
||||||
'settings.branding.*' => ['nullable'],
|
'settings.branding.*' => ['nullable'],
|
||||||
'settings.engagement_mode' => ['nullable', Rule::in(['tasks', 'photo_only'])],
|
'settings.engagement_mode' => ['nullable', Rule::in(['tasks', 'photo_only'])],
|
||||||
|
'settings.guest_downloads_enabled' => ['nullable', 'boolean'],
|
||||||
|
'settings.guest_sharing_enabled' => ['nullable', 'boolean'],
|
||||||
'settings.guest_upload_visibility' => ['nullable', Rule::in(['review', 'immediate'])],
|
'settings.guest_upload_visibility' => ['nullable', Rule::in(['review', 'immediate'])],
|
||||||
'settings.live_show' => ['nullable', 'array'],
|
'settings.live_show' => ['nullable', 'array'],
|
||||||
'settings.live_show.moderation_mode' => ['nullable', Rule::in(['off', 'manual', 'trusted_only'])],
|
'settings.live_show.moderation_mode' => ['nullable', Rule::in(['off', 'manual', 'trusted_only'])],
|
||||||
@@ -63,6 +73,16 @@ class EventStoreRequest extends FormRequest
|
|||||||
])],
|
])],
|
||||||
'settings.live_show.effect_intensity' => ['nullable', 'integer', 'min:0', 'max:100'],
|
'settings.live_show.effect_intensity' => ['nullable', 'integer', 'min:0', 'max:100'],
|
||||||
'settings.live_show.background_mode' => ['nullable', Rule::in(['blur_last', 'gradient', 'solid', 'brand'])],
|
'settings.live_show.background_mode' => ['nullable', Rule::in(['blur_last', 'gradient', 'solid', 'brand'])],
|
||||||
|
'settings.control_room' => ['nullable', 'array'],
|
||||||
|
'settings.control_room.auto_approve_highlights' => ['nullable', 'boolean'],
|
||||||
|
'settings.control_room.auto_add_approved_to_live' => ['nullable', 'boolean'],
|
||||||
|
'settings.control_room.auto_remove_live_on_hide' => ['nullable', 'boolean'],
|
||||||
|
'settings.control_room.trusted_uploaders' => ['nullable', 'array'],
|
||||||
|
'settings.control_room.trusted_uploaders.*.device_id' => ['required', 'string', 'max:120'],
|
||||||
|
'settings.control_room.trusted_uploaders.*.label' => ['nullable', 'string', 'max:80'],
|
||||||
|
'settings.control_room.force_review_uploaders' => ['nullable', 'array'],
|
||||||
|
'settings.control_room.force_review_uploaders.*.device_id' => ['required', 'string', 'max:120'],
|
||||||
|
'settings.control_room.force_review_uploaders.*.label' => ['nullable', 'string', 'max:80'],
|
||||||
'settings.watermark' => ['nullable', 'array'],
|
'settings.watermark' => ['nullable', 'array'],
|
||||||
'settings.watermark.mode' => ['nullable', Rule::in(['base', 'custom', 'off'])],
|
'settings.watermark.mode' => ['nullable', Rule::in(['base', 'custom', 'off'])],
|
||||||
'settings.watermark.asset' => ['nullable', 'string', 'max:500'],
|
'settings.watermark.asset' => ['nullable', 'string', 'max:500'],
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
namespace App\Http\Requests\Tenant;
|
namespace App\Http\Requests\Tenant;
|
||||||
|
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
use Illuminate\Validation\Rule;
|
|
||||||
|
|
||||||
class PhotoStoreRequest extends FormRequest
|
class PhotoStoreRequest extends FormRequest
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -88,4 +88,3 @@ class SettingsStoreRequest extends FormRequest
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ class EmotionResource extends JsonResource
|
|||||||
}
|
}
|
||||||
|
|
||||||
$first = reset($value);
|
$first = reset($value);
|
||||||
|
|
||||||
return $first !== false ? (string) $first : $fallback;
|
return $first !== false ? (string) $first : $fallback;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,16 @@
|
|||||||
|
|
||||||
namespace App\Http\Resources\Tenant;
|
namespace App\Http\Resources\Tenant;
|
||||||
|
|
||||||
|
use App\Models\WatermarkSetting;
|
||||||
use App\Services\Packages\PackageLimitEvaluator;
|
use App\Services\Packages\PackageLimitEvaluator;
|
||||||
|
use App\Support\TenantMemberPermissions;
|
||||||
|
use App\Support\WatermarkConfigResolver;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Http\Resources\Json\JsonResource;
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||||||
use Illuminate\Http\Resources\MissingValue;
|
use Illuminate\Http\Resources\MissingValue;
|
||||||
use Illuminate\Support\Arr;
|
use Illuminate\Support\Arr;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use Illuminate\Support\Facades\URL;
|
||||||
|
|
||||||
use function app;
|
use function app;
|
||||||
|
|
||||||
@@ -17,7 +22,14 @@ class EventResource extends JsonResource
|
|||||||
$tenantId = $request->attributes->get('tenant_id');
|
$tenantId = $request->attributes->get('tenant_id');
|
||||||
$showSensitive = $this->tenant_id === $tenantId;
|
$showSensitive = $this->tenant_id === $tenantId;
|
||||||
$settings = is_array($this->settings) ? $this->settings : [];
|
$settings = is_array($this->settings) ? $this->settings : [];
|
||||||
|
$settings = $this->attachWatermarkAssetUrl($settings);
|
||||||
$eventPackage = null;
|
$eventPackage = null;
|
||||||
|
$memberPermissions = null;
|
||||||
|
|
||||||
|
$user = $request->user();
|
||||||
|
if ($user && $user->role === 'member') {
|
||||||
|
$memberPermissions = TenantMemberPermissions::resolveEventPermissions($request, $this->resource);
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->relationLoaded('eventPackages')) {
|
if ($this->relationLoaded('eventPackages')) {
|
||||||
$related = $this->getRelation('eventPackages');
|
$related = $this->getRelation('eventPackages');
|
||||||
@@ -38,6 +50,8 @@ class EventResource extends JsonResource
|
|||||||
$limitEvaluator = app()->make(PackageLimitEvaluator::class);
|
$limitEvaluator = app()->make(PackageLimitEvaluator::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$settings['watermark_removal_allowed'] = WatermarkConfigResolver::determineRemovalAllowed($this->resource);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'id' => $this->id,
|
'id' => $this->id,
|
||||||
'name' => $this->name,
|
'name' => $this->name,
|
||||||
@@ -83,12 +97,105 @@ class EventResource extends JsonResource
|
|||||||
'watermark_allowed' => (bool) optional($eventPackage->package)->watermark_allowed,
|
'watermark_allowed' => (bool) optional($eventPackage->package)->watermark_allowed,
|
||||||
] : null,
|
] : null,
|
||||||
'limits' => $eventPackage && $limitEvaluator
|
'limits' => $eventPackage && $limitEvaluator
|
||||||
? $limitEvaluator->summarizeEventPackage($eventPackage)
|
? $limitEvaluator->summarizeEventPackage($eventPackage, $this->resolveTasksUsed())
|
||||||
: null,
|
: null,
|
||||||
'addons' => $eventPackage ? $this->formatAddons($eventPackage) : [],
|
'addons' => $eventPackage ? $this->formatAddons($eventPackage) : [],
|
||||||
|
'member_permissions' => $memberPermissions,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function resolveTasksUsed(): ?int
|
||||||
|
{
|
||||||
|
if (isset($this->tasks_count)) {
|
||||||
|
return (int) $this->tasks_count;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->relationLoaded('tasks')) {
|
||||||
|
return $this->tasks->count();
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<string, mixed> $settings
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
protected function attachWatermarkAssetUrl(array $settings): array
|
||||||
|
{
|
||||||
|
$watermark = Arr::get($settings, 'watermark');
|
||||||
|
$base = config('watermark.base', []);
|
||||||
|
$base = is_array($base) ? $base : [];
|
||||||
|
$baseSetting = null;
|
||||||
|
|
||||||
|
if (class_exists(WatermarkSetting::class) && Schema::hasTable('watermark_settings')) {
|
||||||
|
try {
|
||||||
|
$baseSetting = WatermarkSetting::query()->first();
|
||||||
|
} catch (\Throwable) {
|
||||||
|
$baseSetting = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($baseSetting) {
|
||||||
|
$base = array_merge($base, array_filter([
|
||||||
|
'asset' => $baseSetting->asset,
|
||||||
|
'position' => $baseSetting->position,
|
||||||
|
'opacity' => $baseSetting->opacity,
|
||||||
|
'scale' => $baseSetting->scale,
|
||||||
|
'padding' => $baseSetting->padding,
|
||||||
|
'offset_x' => $baseSetting->offset_x,
|
||||||
|
'offset_y' => $baseSetting->offset_y,
|
||||||
|
], static fn ($value) => $value !== null));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! is_array($watermark)) {
|
||||||
|
$watermark = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$mode = $watermark['mode'] ?? null;
|
||||||
|
if (! is_string($mode) || $mode === '') {
|
||||||
|
$mode = 'base';
|
||||||
|
$watermark['mode'] = $mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($mode !== 'off') {
|
||||||
|
foreach (['position', 'opacity', 'scale', 'padding', 'offset_x', 'offset_y'] as $key) {
|
||||||
|
if (! array_key_exists($key, $watermark) && array_key_exists($key, $base)) {
|
||||||
|
$watermark[$key] = $base[$key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$asset = $watermark['asset'] ?? null;
|
||||||
|
if ((! is_string($asset) || $asset === '') && $mode !== 'off') {
|
||||||
|
$asset = $base['asset'] ?? null;
|
||||||
|
if (is_string($asset) && $asset !== '') {
|
||||||
|
$watermark['asset'] = $asset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! is_string($asset) || $asset === '') {
|
||||||
|
$settings['watermark'] = $watermark;
|
||||||
|
|
||||||
|
return $settings;
|
||||||
|
}
|
||||||
|
|
||||||
|
$normalized = ltrim($asset, '/');
|
||||||
|
if (str_starts_with($normalized, 'storage/')) {
|
||||||
|
$normalized = substr($normalized, strlen('storage/'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$watermark['asset_url'] = URL::temporarySignedRoute(
|
||||||
|
'api.v1.branding.asset',
|
||||||
|
now()->addSeconds(3600),
|
||||||
|
['path' => $normalized]
|
||||||
|
);
|
||||||
|
|
||||||
|
$settings['watermark'] = $watermark;
|
||||||
|
|
||||||
|
return $settings;
|
||||||
|
}
|
||||||
|
|
||||||
protected function formatAddons(?\App\Models\EventPackage $eventPackage): array
|
protected function formatAddons(?\App\Models\EventPackage $eventPackage): array
|
||||||
{
|
{
|
||||||
if (! $eventPackage) {
|
if (! $eventPackage) {
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ class PhotoResource extends JsonResource
|
|||||||
'is_liked' => false,
|
'is_liked' => false,
|
||||||
'uploaded_at' => $this->created_at->toISOString(),
|
'uploaded_at' => $this->created_at->toISOString(),
|
||||||
'uploader_name' => $this->guest_name ?? null,
|
'uploader_name' => $this->guest_name ?? null,
|
||||||
|
'created_by_device_id' => $showSensitive ? $this->created_by_device_id : null,
|
||||||
'ingest_source' => $this->ingest_source,
|
'ingest_source' => $this->ingest_source,
|
||||||
'event' => [
|
'event' => [
|
||||||
'id' => $this->event->id,
|
'id' => $this->event->id,
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class PhotoboothStatusResource extends JsonResource
|
|||||||
'password' => $password,
|
'password' => $password,
|
||||||
'path' => $eventSetting?->path,
|
'path' => $eventSetting?->path,
|
||||||
'ftp_url' => $isSparkbooth ? null : $this->buildFtpUrl($eventSetting, $settings, $password),
|
'ftp_url' => $isSparkbooth ? null : $this->buildFtpUrl($eventSetting, $settings, $password),
|
||||||
'upload_url' => $isSparkbooth ? route('api.v1.photobooth.sparkbooth.upload') : null,
|
'upload_url' => $isSparkbooth ? route('api.v1.photobooth.upload') : null,
|
||||||
'expires_at' => optional($activeExpires)->toIso8601String(),
|
'expires_at' => optional($activeExpires)->toIso8601String(),
|
||||||
'rate_limit_per_minute' => (int) $settings->rate_limit_per_minute,
|
'rate_limit_per_minute' => (int) $settings->rate_limit_per_minute,
|
||||||
'ftp' => [
|
'ftp' => [
|
||||||
@@ -62,7 +62,7 @@ class PhotoboothStatusResource extends JsonResource
|
|||||||
'username' => $mode === 'sparkbooth' ? $eventSetting?->username : null,
|
'username' => $mode === 'sparkbooth' ? $eventSetting?->username : null,
|
||||||
'password' => $mode === 'sparkbooth' ? $password : null,
|
'password' => $mode === 'sparkbooth' ? $password : null,
|
||||||
'expires_at' => $mode === 'sparkbooth' ? optional($eventSetting?->expires_at)->toIso8601String() : null,
|
'expires_at' => $mode === 'sparkbooth' ? optional($eventSetting?->expires_at)->toIso8601String() : null,
|
||||||
'upload_url' => route('api.v1.photobooth.sparkbooth.upload'),
|
'upload_url' => route('api.v1.photobooth.upload'),
|
||||||
'response_format' => ($eventSetting?->metadata ?? [])['sparkbooth_response_format'] ?? config('photobooth.sparkbooth.response_format', 'json'),
|
'response_format' => ($eventSetting?->metadata ?? [])['sparkbooth_response_format'] ?? config('photobooth.sparkbooth.response_format', 'json'),
|
||||||
'metrics' => $sparkMetrics,
|
'metrics' => $sparkMetrics,
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ class ArchiveEventMediaAssets implements ShouldQueue
|
|||||||
|
|
||||||
if (! $event) {
|
if (! $event) {
|
||||||
Log::warning('Archive job aborted: event missing', ['event_id' => $this->eventId]);
|
Log::warning('Archive job aborted: event missing', ['event_id' => $this->eventId]);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,6 +39,7 @@ class ArchiveEventMediaAssets implements ShouldQueue
|
|||||||
|
|
||||||
if (! $archiveDisk) {
|
if (! $archiveDisk) {
|
||||||
Log::warning('Archive job aborted: no archive disk configured', ['event_id' => $event->id]);
|
Log::warning('Archive job aborted: no archive disk configured', ['event_id' => $event->id]);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,12 +2,12 @@
|
|||||||
|
|
||||||
namespace App\Jobs\Concerns;
|
namespace App\Jobs\Concerns;
|
||||||
|
|
||||||
|
use App\Models\Tenant;
|
||||||
use App\Models\TenantNotificationLog;
|
use App\Models\TenantNotificationLog;
|
||||||
use App\Models\TenantNotificationReceipt;
|
use App\Models\TenantNotificationReceipt;
|
||||||
use App\Models\Tenant;
|
|
||||||
use App\Services\Packages\TenantNotificationLogger;
|
use App\Services\Packages\TenantNotificationLogger;
|
||||||
use Illuminate\Support\Facades\Log;
|
|
||||||
use Illuminate\Support\Carbon;
|
use Illuminate\Support\Carbon;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
trait LogsTenantNotifications
|
trait LogsTenantNotifications
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ class ProcessPhotoSecurityScan implements ShouldQueue
|
|||||||
|
|
||||||
if (! $photo) {
|
if (! $photo) {
|
||||||
Log::warning('[PhotoSecurity] Skipping missing photo', ['photo_id' => $this->photoId]);
|
Log::warning('[PhotoSecurity] Skipping missing photo', ['photo_id' => $this->photoId]);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,6 +67,7 @@ class ProcessPhotoSecurityScan implements ShouldQueue
|
|||||||
}
|
}
|
||||||
|
|
||||||
$existingMeta = $photo->security_meta ?? [];
|
$existingMeta = $photo->security_meta ?? [];
|
||||||
|
$requiresManualReview = is_array($existingMeta) && ($existingMeta['manual_review'] ?? false);
|
||||||
|
|
||||||
$update = [
|
$update = [
|
||||||
'security_scan_status' => $status,
|
'security_scan_status' => $status,
|
||||||
@@ -74,7 +76,7 @@ class ProcessPhotoSecurityScan implements ShouldQueue
|
|||||||
'security_meta' => array_merge(is_array($existingMeta) ? $existingMeta : [], $metadata),
|
'security_meta' => array_merge(is_array($existingMeta) ? $existingMeta : [], $metadata),
|
||||||
];
|
];
|
||||||
|
|
||||||
if (in_array($status, ['clean', 'skipped'], true) && $photo->status === 'pending') {
|
if (in_array($status, ['clean', 'skipped'], true) && $photo->status === 'pending' && ! $requiresManualReview) {
|
||||||
$update['status'] = 'approved';
|
$update['status'] = 'approved';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class AbandonedCheckout extends Mailable
|
|||||||
public function envelope(): Envelope
|
public function envelope(): Envelope
|
||||||
{
|
{
|
||||||
return new Envelope(
|
return new Envelope(
|
||||||
subject: __('emails.abandoned_checkout.subject_' . $this->timing, [
|
subject: __('emails.abandoned_checkout.subject_'.$this->timing, [
|
||||||
'package' => $this->localizedPackageName(),
|
'package' => $this->localizedPackageName(),
|
||||||
]),
|
]),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -13,9 +13,7 @@ class ContactConfirmation extends Mailable
|
|||||||
use Queueable;
|
use Queueable;
|
||||||
use SerializesModels;
|
use SerializesModels;
|
||||||
|
|
||||||
public function __construct(public string $name)
|
public function __construct(public string $name) {}
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public function envelope(): Envelope
|
public function envelope(): Envelope
|
||||||
{
|
{
|
||||||
|
|||||||
50
app/Mail/PhotoboothUploaderDownload.php
Normal file
50
app/Mail/PhotoboothUploaderDownload.php
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Mail;
|
||||||
|
|
||||||
|
use Illuminate\Bus\Queueable;
|
||||||
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
|
use Illuminate\Mail\Mailable;
|
||||||
|
use Illuminate\Mail\Mailables\Content;
|
||||||
|
use Illuminate\Mail\Mailables\Envelope;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
class PhotoboothUploaderDownload extends Mailable implements ShouldQueue
|
||||||
|
{
|
||||||
|
use Queueable, SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array{windows:string, macos:string, linux:string} $links
|
||||||
|
*/
|
||||||
|
public function __construct(
|
||||||
|
public string $recipientName,
|
||||||
|
public string $eventName,
|
||||||
|
public array $links,
|
||||||
|
) {}
|
||||||
|
|
||||||
|
public function envelope(): Envelope
|
||||||
|
{
|
||||||
|
return new Envelope(
|
||||||
|
subject: __('emails.photobooth_uploader.subject', [
|
||||||
|
'event' => $this->eventName,
|
||||||
|
]),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function content(): Content
|
||||||
|
{
|
||||||
|
return new Content(
|
||||||
|
view: 'emails.photobooth-uploader-download',
|
||||||
|
with: [
|
||||||
|
'recipientName' => $this->recipientName,
|
||||||
|
'eventName' => $this->eventName,
|
||||||
|
'links' => $this->links,
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function attachments(): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -75,11 +75,11 @@ class AbandonedCheckout extends Model
|
|||||||
public function scopeReadyForReminder($query, string $stage, int $hours)
|
public function scopeReadyForReminder($query, string $stage, int $hours)
|
||||||
{
|
{
|
||||||
return $query->where('reminder_stage', '!=', $stage)
|
return $query->where('reminder_stage', '!=', $stage)
|
||||||
->where('reminder_stage', '!=', 'converted')
|
->where('reminder_stage', '!=', 'converted')
|
||||||
->where('abandoned_at', '<=', now()->subHours($hours))
|
->where('abandoned_at', '<=', now()->subHours($hours))
|
||||||
->where(function ($q) {
|
->where(function ($q) {
|
||||||
$q->whereNull('reminded_at')
|
$q->whereNull('reminded_at')
|
||||||
->orWhere('reminded_at', '<=', now()->subHours(24));
|
->orWhere('reminded_at', '<=', now()->subHours(24));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use Illuminate\Support\Facades\Log;
|
|
||||||
|
|
||||||
class BlogCategory extends Model
|
class BlogCategory extends Model
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,19 +8,18 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use Illuminate\Support\Facades\Storage;
|
|
||||||
use Spatie\Translatable\HasTranslations;
|
|
||||||
use League\CommonMark\Environment\Environment;
|
use League\CommonMark\Environment\Environment;
|
||||||
use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension;
|
|
||||||
use League\CommonMark\Extension\Table\TableExtension;
|
|
||||||
use League\CommonMark\Extension\Autolink\AutolinkExtension;
|
use League\CommonMark\Extension\Autolink\AutolinkExtension;
|
||||||
|
use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension;
|
||||||
use League\CommonMark\Extension\Strikethrough\StrikethroughExtension;
|
use League\CommonMark\Extension\Strikethrough\StrikethroughExtension;
|
||||||
|
use League\CommonMark\Extension\Table\TableExtension;
|
||||||
use League\CommonMark\Extension\TaskList\TaskListExtension;
|
use League\CommonMark\Extension\TaskList\TaskListExtension;
|
||||||
use League\CommonMark\MarkdownConverter;
|
use League\CommonMark\MarkdownConverter;
|
||||||
|
use Spatie\Translatable\HasTranslations;
|
||||||
|
|
||||||
class BlogPost extends Model
|
class BlogPost extends Model
|
||||||
{
|
{
|
||||||
use HasFactory, SoftDeletes, HasTranslations;
|
use HasFactory, HasTranslations, SoftDeletes;
|
||||||
|
|
||||||
protected $table = 'blog_posts';
|
protected $table = 'blog_posts';
|
||||||
|
|
||||||
@@ -64,12 +63,11 @@ class BlogPost extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
$path = ltrim($this->banner, '/');
|
$path = ltrim($this->banner, '/');
|
||||||
|
if (str_starts_with($path, 'storage/')) {
|
||||||
|
$path = substr($path, strlen('storage/'));
|
||||||
|
}
|
||||||
|
|
||||||
return \URL::temporarySignedRoute(
|
return \Storage::disk('public')->url($path);
|
||||||
'api.v1.branding.asset',
|
|
||||||
now()->addMinutes(30),
|
|
||||||
['path' => $path]
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,14 +76,15 @@ class BlogPost extends Model
|
|||||||
return Attribute::get(function () {
|
return Attribute::get(function () {
|
||||||
$markdown = $this->getTranslation('content', app()->getLocale());
|
$markdown = $this->getTranslation('content', app()->getLocale());
|
||||||
|
|
||||||
$environment = new Environment();
|
$environment = new Environment;
|
||||||
$environment->addExtension(new CommonMarkCoreExtension());
|
$environment->addExtension(new CommonMarkCoreExtension);
|
||||||
$environment->addExtension(new TableExtension());
|
$environment->addExtension(new TableExtension);
|
||||||
$environment->addExtension(new AutolinkExtension());
|
$environment->addExtension(new AutolinkExtension);
|
||||||
$environment->addExtension(new StrikethroughExtension());
|
$environment->addExtension(new StrikethroughExtension);
|
||||||
$environment->addExtension(new TaskListExtension());
|
$environment->addExtension(new TaskListExtension);
|
||||||
|
|
||||||
$converter = new MarkdownConverter($environment);
|
$converter = new MarkdownConverter($environment);
|
||||||
|
|
||||||
return (string) $converter->convert($markdown);
|
return (string) $converter->convert($markdown);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,14 +3,13 @@
|
|||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use Spatie\Tags\Tag;
|
use Spatie\Tags\Tag;
|
||||||
use Spatie\Translatable\HasTranslations;
|
use Spatie\Translatable\HasTranslations;
|
||||||
|
|
||||||
class BlogTag extends Tag
|
class BlogTag extends Tag
|
||||||
{
|
{
|
||||||
use HasFactory, SoftDeletes, HasTranslations;
|
use HasFactory, HasTranslations, SoftDeletes;
|
||||||
|
|
||||||
protected $translatable = [
|
protected $translatable = [
|
||||||
'name',
|
'name',
|
||||||
|
|||||||
@@ -13,7 +13,9 @@ class Emotion extends Model
|
|||||||
use HasFactory;
|
use HasFactory;
|
||||||
|
|
||||||
protected $table = 'emotions';
|
protected $table = 'emotions';
|
||||||
|
|
||||||
protected $guarded = [];
|
protected $guarded = [];
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'name' => 'array',
|
'name' => 'array',
|
||||||
'description' => 'array',
|
'description' => 'array',
|
||||||
@@ -34,4 +36,3 @@ class Emotion extends Model
|
|||||||
return $this->hasMany(Task::class);
|
return $this->hasMany(Task::class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -95,9 +95,9 @@ class Event extends Model
|
|||||||
->withTimestamps();
|
->withTimestamps();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function eventPackage(): BelongsTo
|
public function eventPackage(): HasOne
|
||||||
{
|
{
|
||||||
return $this->belongsTo(EventPackage::class);
|
return $this->hasOne(EventPackage::class)->latestOfMany();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function eventPackages(): HasMany
|
public function eventPackages(): HasMany
|
||||||
|
|||||||
@@ -47,4 +47,3 @@ class EventJoinTokenEvent extends Model
|
|||||||
return $this->belongsTo(Tenant::class);
|
return $this->belongsTo(Tenant::class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,4 +51,3 @@ class EventMediaAsset extends Model
|
|||||||
return $this->belongsTo(Photo::class);
|
return $this->belongsTo(Photo::class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,9 @@ class EventPurchase extends Model
|
|||||||
use HasFactory;
|
use HasFactory;
|
||||||
|
|
||||||
protected $table = 'event_purchases';
|
protected $table = 'event_purchases';
|
||||||
|
|
||||||
protected $guarded = [];
|
protected $guarded = [];
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'purchased_at' => 'datetime',
|
'purchased_at' => 'datetime',
|
||||||
'amount' => 'decimal:2',
|
'amount' => 'decimal:2',
|
||||||
|
|||||||
@@ -36,4 +36,3 @@ class EventStorageAssignment extends Model
|
|||||||
return $this->belongsTo(MediaStorageTarget::class, 'media_storage_target_id');
|
return $this->belongsTo(MediaStorageTarget::class, 'media_storage_target_id');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,9 @@ class EventType extends Model
|
|||||||
use HasFactory;
|
use HasFactory;
|
||||||
|
|
||||||
protected $table = 'event_types';
|
protected $table = 'event_types';
|
||||||
|
|
||||||
protected $guarded = [];
|
protected $guarded = [];
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'name' => 'array',
|
'name' => 'array',
|
||||||
'settings' => 'array',
|
'settings' => 'array',
|
||||||
@@ -28,4 +30,3 @@ class EventType extends Model
|
|||||||
return $this->hasMany(Event::class);
|
return $this->hasMany(Event::class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,9 @@ use Illuminate\Database\Eloquent\Model;
|
|||||||
class LegalPage extends Model
|
class LegalPage extends Model
|
||||||
{
|
{
|
||||||
protected $table = 'legal_pages';
|
protected $table = 'legal_pages';
|
||||||
|
|
||||||
protected $guarded = [];
|
protected $guarded = [];
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'title' => 'array',
|
'title' => 'array',
|
||||||
'body_markdown' => 'array',
|
'body_markdown' => 'array',
|
||||||
@@ -15,4 +17,3 @@ class LegalPage extends Model
|
|||||||
'effective_from' => 'datetime',
|
'effective_from' => 'datetime',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -63,4 +63,3 @@ class MediaStorageTarget extends Model
|
|||||||
return array_merge($base, $config);
|
return array_merge($base, $config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ class Package extends Model
|
|||||||
'name_translations',
|
'name_translations',
|
||||||
'slug',
|
'slug',
|
||||||
'type',
|
'type',
|
||||||
|
'included_package_slug',
|
||||||
'price',
|
'price',
|
||||||
'max_photos',
|
'max_photos',
|
||||||
'max_guests',
|
'max_guests',
|
||||||
|
|||||||
@@ -8,7 +8,9 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|||||||
class PhotoLike extends Model
|
class PhotoLike extends Model
|
||||||
{
|
{
|
||||||
protected $table = 'photo_likes';
|
protected $table = 'photo_likes';
|
||||||
|
|
||||||
protected $guarded = [];
|
protected $guarded = [];
|
||||||
|
|
||||||
public $timestamps = false;
|
public $timestamps = false;
|
||||||
|
|
||||||
public function photo(): BelongsTo
|
public function photo(): BelongsTo
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user