Event identifiers for anonymizations
This commit is contained in:
@@ -7,6 +7,7 @@ use App\Models\Event;
|
|||||||
use App\Models\Tenant;
|
use App\Models\Tenant;
|
||||||
use App\RelationModels\EventEatingHabits;
|
use App\RelationModels\EventEatingHabits;
|
||||||
use App\RelationModels\EventLocalGroups;
|
use App\RelationModels\EventLocalGroups;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
class CreateEventCommand {
|
class CreateEventCommand {
|
||||||
private CreateEventRequest $request;
|
private CreateEventRequest $request;
|
||||||
@@ -27,6 +28,7 @@ class CreateEventCommand {
|
|||||||
$event = Event::create([
|
$event = Event::create([
|
||||||
'tenant' => app('tenant')->slug,
|
'tenant' => app('tenant')->slug,
|
||||||
'name' => $this->request->name,
|
'name' => $this->request->name,
|
||||||
|
'identifier' => Str::random(10),
|
||||||
'location' => $this->request->location,
|
'location' => $this->request->location,
|
||||||
'postal_code' => $this->request->postalCode,
|
'postal_code' => $this->request->postalCode,
|
||||||
'email' => $this->request->email,
|
'email' => $this->request->email,
|
||||||
|
|||||||
@@ -18,13 +18,13 @@ use Illuminate\Http\Request;
|
|||||||
use Illuminate\Support\Facades\Mail;
|
use Illuminate\Support\Facades\Mail;
|
||||||
|
|
||||||
class SignupController extends CommonController {
|
class SignupController extends CommonController {
|
||||||
public function __invoke(int $eventId, Request $request) {
|
public function __invoke(string $eventId, Request $request) {
|
||||||
$availableEvents = [];
|
$availableEvents = [];
|
||||||
foreach ($this->events->getAvailable(false) as $event) {
|
foreach ($this->events->getAvailable(false) as $event) {
|
||||||
$availableEvents[] = $event->toResource()->toArray($request);
|
$availableEvents[] = $event->toResource()->toArray($request);
|
||||||
};
|
};
|
||||||
|
|
||||||
$event = $this->events->getById($eventId, false)?->toResource()->toArray($request);
|
$event = $this->events->getByIdentifier($eventId, false)?->toResource()->toArray($request);
|
||||||
|
|
||||||
$participantData = [
|
$participantData = [
|
||||||
'firstname' => '',
|
'firstname' => '',
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ console.log(props.events)
|
|||||||
|
|
||||||
<div style="margin-top: 20px; display: flex; justify-content: flex-end;">
|
<div style="margin-top: 20px; display: flex; justify-content: flex-end;">
|
||||||
<a
|
<a
|
||||||
:href="'/event/' + event.id + '/signup'"
|
:href="'/event/' + event.identifier + '/signup'"
|
||||||
style="
|
style="
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
padding: 10px 24px;
|
padding: 10px 24px;
|
||||||
|
|||||||
@@ -33,6 +33,11 @@ class EventRepository {
|
|||||||
return $events[0] ?? null;
|
return $events[0] ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getByIdentifier(string $identifier, bool $accessCheck = true) : ?Event {
|
||||||
|
$events = self::getEventsByCriteria(['identifier' => $identifier], $accessCheck);
|
||||||
|
return $events[0] ?? null;
|
||||||
|
}
|
||||||
|
|
||||||
public function getEventsByCriteria(array $criteria, $accessCheck = true) : array {
|
public function getEventsByCriteria(array $criteria, $accessCheck = true) : array {
|
||||||
$tenant = app('tenant');
|
$tenant = app('tenant');
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ class EventResource extends JsonResource{
|
|||||||
$returnArray = [
|
$returnArray = [
|
||||||
'id' => $this->event->id,
|
'id' => $this->event->id,
|
||||||
'name' => $this->event->name,
|
'name' => $this->event->name,
|
||||||
|
'identifier' => $this->event->identifier,
|
||||||
'location' => $this->event->location,
|
'location' => $this->event->location,
|
||||||
'postalCode' => $this->event->postal_code,
|
'postalCode' => $this->event->postal_code,
|
||||||
'email' => $this->event->email,
|
'email' => $this->event->email,
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ return new class extends Migration {
|
|||||||
$table->foreignId('cost_unit_id')->nullable()->constrained('cost_units', 'id')->restrictOnDelete()->cascadeOnUpdate();
|
$table->foreignId('cost_unit_id')->nullable()->constrained('cost_units', 'id')->restrictOnDelete()->cascadeOnUpdate();
|
||||||
|
|
||||||
$table->string('name');
|
$table->string('name');
|
||||||
|
$table->string('identifier');
|
||||||
$table->string('location');
|
$table->string('location');
|
||||||
$table->string('postal_code');
|
$table->string('postal_code');
|
||||||
$table->string('email');
|
$table->string('email');
|
||||||
|
|||||||
Reference in New Issue
Block a user