/** Datei: plugins/events/library/ARUNOX/Plugins/Events/Model.php **/ [ "table" => "events_tickets", "on" => "events_tickets.id = events_bookings.ticket_id", "CONDITIONS" => [ "origin_id" => $event_id, ] ], ]); } public static function getByTicketId( int $ticket_id ) : array { return static::getAllByColumn('ticket_id', $ticket_id ); } /* ### MAGIC FUNCTIONS ########################################## # */ } /** Datei: plugins/events/library/ARUNOX/Plugins/Events/Bookings/API/v1/Routes.php **/ * @copyright 2025 ARUNOX * @version 1.1.0 * * @since 1.0.0 File is created */ namespace ARUNOX\Plugins\Events\Bookings\API\v1; use ARUNOX\Core\Hooks; use ARUNOX\Core\Router; use ARUNOX\Plugins\Users; class Routes { public static function register() : void { Router::get('/api/v1/events/{id}/bookings', [ Controller::class, 'getByEventId' ]); Router::get('/api/v1/events/{id}/bookings/create', [ Controller::class, 'restConfigCreate' ]); Router::post('/api/v1/events/{id}/bookings', [ Controller::class, 'create' ]); Router::get('/api/v1/events/{id}/bookings/{id}', [ Controller::class, 'get' ]); Router::put('/api/v1/events/{id}/bookings/{id}', [ Controller::class, 'save' ]); Router::patch('/api/v1/events/{id}/bookings/{id}/status', [ Controller::class, 'toggleStatus' ]); Router::get('/api/v1/events/{id}/bookings/{id}/delete', [ Controller::class, 'restConfigDelete' ]); Router::delete('/api/v1/events/{id}/bookings/{id}', [ Controller::class, 'delete' ]); Hooks::add('router::get->api.v1.rest.routes', function( $routes ) { $routes[] = [ "path" => "/events/bookings/{id}", "label" => "Bearbeiten", ]; return $routes; }); } } /** Datei: plugins/events/library/ARUNOX/Plugins/Events/Bookings/API/v1/Controller.php **/ * @copyright 2025 ARUNOX * @version 1.1.0 * * @since 1.0.0 File is created */ namespace ARUNOX\Plugins\Events\Bookings\API\v1; use ARUNOX\HTTP; use ARUNOX\Core\Hooks; use ARUNOX\Plugins\REST; use ARUNOX\Plugins\Events; use ARUNOX\API\BaseController; class Controller extends BaseController { /* ### VARIABLES ################################################ # */ protected static array $NOTIFY = [ "notfound" => "Booking nicht gefunden", "saved" => "Booking wurde erfolgreich gespeichert", "deleted" => "Booking wurde erfolgreich gelöscht", "created" => "Booking wurde erfolgreich erstellt", "notcreated" => "Booking konnte nicht erstellt werden", ]; /* ### PUBLIC FUNCTIONS ######################################### # */ public function getByEventId( int $id ) : HTTP\Response { $results = Events\Bookings\Model::getByEventId( $id ); return $this->jsonResponse( $results ); } public function get( int $origin, int $id ) : HTTP\Response { if( $result = Events\Bookings\Model::get([ "id" => $id, "origin_id" => $origin ]) ) { $this->restConfigDetails( $result ); } else REST\Response::addNotify( "danger", static::getNotify("notfound") ); return REST\Response::jsonResponse(); } /* ### PUBLIC SAVE FUNCTIONS #################################### # */ public function save( int $origin, int $id, array $data ) : HTTP\Response { if( $result = Events\Bookings\Model::get([ "id" => $id, "origin_id" => $origin ]) ) { $result->save( $data ); REST\Response::addNotify( "success", static::getNotify("saved") ); REST\Response::closeModals(); REST\Response::addUpdater( [ "data/table/row", "/api/v1/events/{$result->origin_id}/bookings", $id ], $result ); } else REST\Response::addNotify( "danger", static::getNotify("notfound") ); return REST\Response::jsonResponse(); } public function create( int $origin, array $data ) : HTTP\Response { $data[ "origin_id" ] = $origin; if( $id = Events\Bookings\Model::save( $data ) ) { $result = Events\Bookings\Model::get( $id ); REST\Response::addNotify( "success", static::getNotify("created") ); REST\Response::closeModals(); REST\Response::redirect( "/events/{$result->origin_id}#bookings" ); } else REST\Response::addNotify( "danger", static::getNotify("notcreated") ); return REST\Response::jsonResponse(); } public function delete( int $origin, int $id ) : HTTP\Response { $result = Events\Bookings\Model::get([ "id" => $id, "origin_id" => $origin ]); REST\Response::closeModals(); if( $result && Events\Bookings\Model::delete( $id ) ) { REST\Response::addNotify( "success", static::getNotify("deleted") ); REST\Response::redirect( "/events/{$result->origin_id}#bookings" ); } else REST\Response::addNotify( "danger", static::getNotify("notfound") ); return REST\Response::jsonResponse(); } public function toggleStatus( int $origin, int $id ) : HTTP\Response { if( $result = Events\Bookings\Model::get([ "id" => $id, "origin_id" => $origin ]) ) { $result->toggleStatus( TRUE ); REST\Response::addUpdater( [ "data/table/row", "/api/v1/events/{$result->origin_id}/bookings", $id ], $result ); } else REST\Response::addNotify( "danger", static::getNotify("notfound") ); return REST\Response::jsonResponse(); } public function toggleAgeCheck( int $origin, int $id ) : HTTP\Response { if( $result = Events\Bookings\Model::get([ "id" => $id, "origin_id" => $origin ]) ) { $result->toggleAgeCheck( TRUE ); REST\Response::addUpdater( [ "data/table/row", "/api/v1/events/{$result->origin_id}/bookings", $id ], $result ); } else REST\Response::addNotify( "danger", static::getNotify("notfound") ); return REST\Response::jsonResponse(); } /* ### PUBLIC VALIDATE FUNCTIONS ################################ # */ /* ### PUBLIC REST FUNCTIONS #################################### # */ public function restConfigDetails( Events\Bookings\Entity $data ) : REST\Generator\Base\BaseGenerator { return REST\Response::addModal( "details", "Booking bearbeiten" ) ->setData( $data ) ->setTitle( $data->type->getLabel() ) ->setIcon( $data->type->getIcon() ) ->setColor( $data->type->getColor() ) ->get() ->setAction( "/api/v1/events/{origin_id}/bookings/{id}", "PUT" ) ->addButton(...Hooks::filter( "rest.generator::button.type->submit", [], "Speichern", "events/{origin_id}/bookings" )) ->addText( "Geben Sie diesem Booking eine für Sie passende Beschreibung, zur besseren Wiedererkennung." ) ->addField(...Hooks::filter( "rest.generator::control.type->text", [], "description", TRUE, "events/{origin_id}/bookings" )) ->addHeadline( "Einstellungen", "3" ); } public function restConfigCreate( ...$args ) : REST\Generator\Base\BaseGenerator { return REST\Response::addModal( "details", "Booking erstellen" ) ->get() ->setAction( "/api/v1/events/{id}/bookings", "POST" ) ->addButton(...Hooks::filter( "rest.generator::button.type->submit", [], "Erstellen", "events/{origin_id}/bookings" )) ->addText( "Geben Sie diesem Booking eine für Sie passende Beschreibung, zur besseren Wiedererkennung." ) ->addField(...Hooks::filter( "rest.generator::control.type->text", [], "description", TRUE, "events/{origin_id}/bookings" )) ->addHeadline( "Einstellungen", "3" ); } public function restConfigDeleteOwn( int $origin, int $id ) : REST\Generator\Base\BaseGenerator { REST\Response::addModal( "details", "Booking Löschen" ) ->setData([ "id" => $id ]) ->setSize( REST\Wrapper\Modal\Size::sm ) ->get() ->setAction( "/api/v1/events/{origin_id}/bookings/{id}", "DELETE" ) ->addText( "Möchtest du wirklich den Datensatz (#{$id}) löschen? " ) ->addButton(...Hooks::filter( "rest.generator::button.type->cancel", [], NULL, "events/{origin_id}/bookings" )) ->addButton(...Hooks::filter( "rest.generator::button.type->delete", [], NULL, "events/{origin_id}/bookings" )); return REST\Response::jsonResponse(); } /* ### PUBLIC REST STATIC FUNCTIONS ############################# # */ public static function restConfigTable() : REST\Generator\Base\BaseGenerator { $table = REST\Generator\Data\Table::create() ->setApi( "/api/v1/events/{id}/bookings" ) ->setAction( "/api/v1/events/{origin_id}/bookings/{id}" ) ->setOrder( "ticket_date", "asc" ) ->setSearch( TRUE ) ->addButton(...Hooks::filter( "rest.generator::button.name->create", [], "events/{id}/bookings" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->text", [ "label" => "Ticket ID", ], "ticket.id", TRUE, TRUE, TRUE, "events" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->text", [ "label" => "Ticket", ], "ticket.title", TRUE, TRUE, TRUE, "events" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->datetime", [ "label" => "Ticket Datum", ], "ticket.date_start", TRUE, TRUE, TRUE, "events" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->icon", [ "options" => Events\Bookings\Status::getAll(), ], "status", [], "events/{origin_id}/bookings" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->text", [], "firstname", TRUE, TRUE, TRUE, "events/{origin_id}/bookings" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->text", [], "lastname", TRUE, TRUE, TRUE, "events/{origin_id}/bookings" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->email", [], "email", TRUE, TRUE, TRUE, "events/{origin_id}/bookings" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->date", [], "birthdate", TRUE, TRUE, TRUE, "events/{origin_id}/bookings" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->datetime", [], "date_edit", FALSE, FALSE, TRUE, "events/{origin_id}/bookings" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->actions", [], [], FALSE, "events/{origin_id}/bookings" ))->get() ->addButton(...Hooks::filter( "rest.generator::action.name->edit", [], "events/{origin_id}/bookings" )) ->addButton(...Hooks::filter( "rest.generator::action.name->delete", [], "events/{origin_id}/bookings" )) ->top(); // $buttons = $table->getButtons(); // // foreach( Events\Bookings\Type::getAll() as $type ) { // $type["name"] = "type"; // // $buttons[0]->addDropdown( ...Hooks::filter( "rest.generator::button.name->create", $type, "events/{id}/bookings" ) ); // } return $table; } } /** Datei: plugins/events/library/ARUNOX/Plugins/Events/Bookings/Entity.php **/ Attribute\Status::class, "date_start" => Attribute\DateTime::class, "date_end" => Attribute\DateTime::class, "ticket" => "ticket", ]; /* ### PUBLIC FUNCTIONS ######################################### # */ public function toggleStatus( bool $save = FALSE ) { $this->status->toggle(); if( $save ) $this->save(); } public function getTicket() { if( isset( $this->ticket ) ) return $this->ticket; return $this->ticket = Tickets\Model::get( $this->ticket_id ); } /* ### MAGIC FUNCTIONS ########################################## # */ } /** Datei: plugins/events/library/ARUNOX/Plugins/Events/Bookings/Status.php **/ [ "color" => REST\Generator\Config\Color::Default, "label" => "Created", "icon" => "bi bi-pencil" ], 1 => [ "color" => REST\Generator\Config\Color::Success, "label" => "Confirmed", "icon" => "bi bi-check-lg" ], 2 => [ "color" => REST\Generator\Config\Color::Secondary, "label" => "Remind", "icon" => "bi bi-clock-history" ], 3 => [ "color" => REST\Generator\Config\Color::Info, "label" => "Informed", "icon" => "bi bi-info-lg" ], ]; /* ### PUBLIC FUNCTIONS ######################################### # */ /* ### MAGIC FUNCTIONS ########################################## # */ } /** Datei: plugins/events/library/ARUNOX/Plugins/Events/Vouchers/Model.php **/ [ "table" => "events_tickets", "on" => "JSON_CONTAINS( events_vouchers.ticket_ids, CAST( events_tickets.id AS CHAR ) )", "CONDITIONS" => [ "origin_id" => $event_id, ] ], ]); } public static function getByTicketId( int $ticket_id ) : array { return static::getAllByColumn('ticket_id', $ticket_id ); } /* ### MAGIC FUNCTIONS ########################################## # */ } /** Datei: plugins/events/library/ARUNOX/Plugins/Events/Vouchers/API/v1/Routes.php **/ * @copyright 2025 ARUNOX * @version 1.1.0 * * @since 1.0.0 File is created */ namespace ARUNOX\Plugins\Events\Vouchers\API\v1; use ARUNOX\Core\Hooks; use ARUNOX\Core\Router; use ARUNOX\Plugins\Users; class Routes { public static function register() : void { Router::get('/api/v1/events/{id}/vouchers', [ Controller::class, 'getByEventId' ]); Router::get('/api/v1/events/{id}/vouchers/create', [ Controller::class, 'restConfigCreate' ]); Router::post('/api/v1/events/{id}/vouchers', [ Controller::class, 'create' ]); Router::get('/api/v1/events/{id}/vouchers/{id}', [ Controller::class, 'get' ]); Router::put('/api/v1/events/{id}/vouchers/{id}', [ Controller::class, 'save' ]); Router::patch('/api/v1/events/{id}/vouchers/{id}/status', [ Controller::class, 'toggleStatus' ]); Router::get('/api/v1/events/{id}/vouchers/{id}/delete', [ Controller::class, 'restConfigDelete' ]); Router::delete('/api/v1/events/{id}/vouchers/{id}', [ Controller::class, 'delete' ]); Hooks::add('router::get->api.v1.rest.routes', function( $routes ) { $routes[] = [ "path" => "/events/vouchers/{id}", "label" => "Bearbeiten", ]; return $routes; }); } } /** Datei: plugins/events/library/ARUNOX/Plugins/Events/Vouchers/API/v1/Controller.php **/ * @copyright 2025 ARUNOX * @version 1.1.0 * * @since 1.0.0 File is created */ namespace ARUNOX\Plugins\Events\Vouchers\API\v1; use ARUNOX\HTTP; use ARUNOX\Core\Hooks; use ARUNOX\Plugins\REST; use ARUNOX\Plugins\Events; use ARUNOX\API\BaseController; class Controller extends BaseController { /* ### VARIABLES ################################################ # */ protected static array $NOTIFY = [ "notfound" => "Voucher nicht gefunden", "saved" => "Voucher wurde erfolgreich gespeichert", "deleted" => "Voucher wurde erfolgreich gelöscht", "created" => "Voucher wurde erfolgreich erstellt", "notcreated" => "Voucher konnte nicht erstellt werden", ]; /* ### PUBLIC FUNCTIONS ######################################### # */ public function getByEventId( int $id ) : HTTP\Response { $results = Events\Vouchers\Model::getByEventId( $id ); return $this->jsonResponse( $results ); } public function get( int $origin, int $id ) : HTTP\Response { if( $result = Events\Vouchers\Model::get([ "id" => $id, "origin_id" => $origin ]) ) { $this->restConfigDetails( $result ); } else REST\Response::addNotify( "danger", static::getNotify("notfound") ); return REST\Response::jsonResponse(); } /* ### PUBLIC SAVE FUNCTIONS #################################### # */ public function save( int $origin, int $id, array $data ) : HTTP\Response { if( $result = Events\Vouchers\Model::get([ "id" => $id, "origin_id" => $origin ]) ) { $result->save( $data ); REST\Response::addNotify( "success", static::getNotify("saved") ); REST\Response::closeModals(); REST\Response::addUpdater( [ "data/table/row", "/api/v1/events/{$result->origin_id}/vouchers", $id ], $result ); } else REST\Response::addNotify( "danger", static::getNotify("notfound") ); return REST\Response::jsonResponse(); } public function create( int $origin, array $data ) : HTTP\Response { $data[ "origin_id" ] = $origin; if( $id = Events\Vouchers\Model::save( $data ) ) { $result = Events\Vouchers\Model::get( $id ); REST\Response::addNotify( "success", static::getNotify("created") ); REST\Response::closeModals(); REST\Response::redirect( "/events/{$result->origin_id}#vouchers" ); } else REST\Response::addNotify( "danger", static::getNotify("notcreated") ); return REST\Response::jsonResponse(); } public function delete( int $origin, int $id ) : HTTP\Response { $result = Events\Vouchers\Model::get([ "id" => $id, "origin_id" => $origin ]); REST\Response::closeModals(); if( $result && Events\Vouchers\Model::delete( $id ) ) { REST\Response::addNotify( "success", static::getNotify("deleted") ); REST\Response::redirect( "/events/{$result->origin_id}#vouchers" ); } else REST\Response::addNotify( "danger", static::getNotify("notfound") ); return REST\Response::jsonResponse(); } public function toggleStatus( int $origin, int $id ) : HTTP\Response { if( $result = Events\Vouchers\Model::get([ "id" => $id, "origin_id" => $origin ]) ) { $result->toggleStatus( TRUE ); REST\Response::addUpdater( [ "data/table/row", "/api/v1/events/{$result->origin_id}/vouchers", $id ], $result ); } else REST\Response::addNotify( "danger", static::getNotify("notfound") ); return REST\Response::jsonResponse(); } public function toggleAgeCheck( int $origin, int $id ) : HTTP\Response { if( $result = Events\Vouchers\Model::get([ "id" => $id, "origin_id" => $origin ]) ) { $result->toggleAgeCheck( TRUE ); REST\Response::addUpdater( [ "data/table/row", "/api/v1/events/{$result->origin_id}/vouchers", $id ], $result ); } else REST\Response::addNotify( "danger", static::getNotify("notfound") ); return REST\Response::jsonResponse(); } /* ### PUBLIC VALIDATE FUNCTIONS ################################ # */ /* ### PUBLIC REST FUNCTIONS #################################### # */ public function restConfigDetails( Events\Vouchers\Entity $data ) : REST\Generator\Base\BaseGenerator { return REST\Response::addModal( "details", "Voucher bearbeiten" ) ->setData( $data ) ->setTitle( $data->type->getLabel() ) ->setIcon( $data->type->getIcon() ) ->setColor( $data->type->getColor() ) ->get() ->setAction( "/api/v1/events/{origin_id}/vouchers/{id}", "PUT" ) ->addButton(...Hooks::filter( "rest.generator::button.type->submit", [], "Speichern", "events/{origin_id}/vouchers" )) ->addText( "Geben Sie diesem Voucher eine für Sie passende Beschreibung, zur besseren Wiedererkennung." ) ->addField(...Hooks::filter( "rest.generator::control.type->text", [], "description", TRUE, "events/{origin_id}/vouchers" )) ->addHeadline( "Einstellungen", "3" ); } public function restConfigCreate( ...$args ) : REST\Generator\Base\BaseGenerator { return REST\Response::addModal( "details", "Voucher erstellen" ) ->get() ->setAction( "/api/v1/events/{id}/vouchers", "POST" ) ->addButton(...Hooks::filter( "rest.generator::button.type->submit", [], "Erstellen", "events/{origin_id}/vouchers" )) ->addText( "Geben Sie diesem Voucher eine für Sie passende Beschreibung, zur besseren Wiedererkennung." ) ->addField(...Hooks::filter( "rest.generator::control.type->text", [], "description", TRUE, "events/{origin_id}/vouchers" )) ->addHeadline( "Einstellungen", "3" ); } public function restConfigDeleteOwn( int $origin, int $id ) : REST\Generator\Base\BaseGenerator { REST\Response::addModal( "details", "Voucher Löschen" ) ->setData([ "id" => $id ]) ->setSize( REST\Wrapper\Modal\Size::sm ) ->get() ->setAction( "/api/v1/events/{origin_id}/vouchers/{id}", "DELETE" ) ->addText( "Möchtest du wirklich den Datensatz (#{$id}) löschen? " ) ->addButton(...Hooks::filter( "rest.generator::button.type->cancel", [], NULL, "events/{origin_id}/vouchers" )) ->addButton(...Hooks::filter( "rest.generator::button.type->delete", [], NULL, "events/{origin_id}/vouchers" )); return REST\Response::jsonResponse(); } /* ### PUBLIC REST STATIC FUNCTIONS ############################# # */ public static function restConfigTable() : REST\Generator\Base\BaseGenerator { $table = REST\Generator\Data\Table::create() ->setApi( "/api/v1/events/{id}/vouchers" ) ->setAction( "/api/v1/events/{origin_id}/vouchers/{id}" ) ->setOrder( "uuid", "asc" ) ->setSearch( TRUE ) ->addButton(...Hooks::filter( "rest.generator::button.name->create", [], "events/{id}/vouchers" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->text", [], "uuid", TRUE, TRUE, TRUE, "events/{origin_id}/vouchers" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->status", [ "options" => Events\Vouchers\Type::getAll(), ], "type", [], "events/{origin_id}/vouchers" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->text", [ "label" => "Ticket", ], "ticket_name", TRUE, TRUE, TRUE, "events" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->text", [], "identifier", TRUE, TRUE, TRUE, "events/{origin_id}/vouchers" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->datetime", [ "label" => "Verwendet am", ], "date_use", FALSE, FALSE, TRUE, "events/{origin_id}/vouchers" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->datetime", [], "date_edit", FALSE, FALSE, TRUE, "events/{origin_id}/vouchers" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->actions", [], [], FALSE, "events/{origin_id}/vouchers" ))->get() ->addButton(...Hooks::filter( "rest.generator::action.name->edit", [], "events/{origin_id}/vouchers" )) ->addButton(...Hooks::filter( "rest.generator::action.name->delete", [], "events/{origin_id}/vouchers" )) ->top(); // $buttons = $table->getButtons(); // // foreach( Events\Vouchers\Type::getAll() as $type ) { // $type["name"] = "type"; // // $buttons[0]->addDropdown( ...Hooks::filter( "rest.generator::button.name->create", $type, "events/{id}/vouchers" ) ); // } return $table; } } /** Datei: plugins/events/library/ARUNOX/Plugins/Events/Vouchers/Type.php **/ [ "color" => REST\Generator\Config\Color::Info, "icon" => "bi bi-qr-code", "label" => "Code" ], 1 => [ "color" => REST\Generator\Config\Color::Danger, "icon" => "bi bi-envelope-at", "label" => "E-Mail" ], 2 => [ "color" => REST\Generator\Config\Color::Danger, "icon" => "bi bi-phone-vibrate", "label" => "SMS" ], 3 => [ "color" => REST\Generator\Config\Color::Success, "icon" => "bi bi-list-columns", "label" => "Liste" ], ]; /* ### PUBLIC FUNCTIONS ######################################### # */ } /** Datei: plugins/events/library/ARUNOX/Plugins/Events/Vouchers/Entity.php **/ Type::class, "date_use" => Attribute\DateTime::class, "ticket_name" => "ticketName", ]; /* ### PUBLIC FUNCTIONS ######################################### # */ public function getTicketName() { $ids = json_decode( $this->ticket_ids ); $first = array_shift( $ids ); $first = Tickets\Model::get( $first ); $count = count( $ids ); $label = "Keine Zuordnungen"; if( $first ) $label = $first->title; if( $count > 0 ) $label .= " » {$count} weitere"; return $label; } /* ### MAGIC FUNCTIONS ########################################## # */ } /** Datei: plugins/events/library/ARUNOX/Plugins/Events/API/v1/Routes.php **/ * @copyright 2025 ARUNOX * @version 1.1.0 * * @since 1.0.0 File is created */ namespace ARUNOX\Plugins\Events\API\v1; use ARUNOX\Core\Hooks; use ARUNOX\Core\Router; use ARUNOX\Plugins\Users; class Routes { public static function register() : void { Router::get('/api/v1/events', [ Controller::class, 'getAll' ]); Router::get('/api/v1/events/create', [ Controller::class, 'restConfigCreate' ]); Router::post('/api/v1/events', [ Controller::class, 'create' ]); Router::get('/api/v1/events/{id}', [ Controller::class, 'get' ]); Router::put('/api/v1/events/{id}', [ Controller::class, 'save' ]); Router::patch('/api/v1/events/{id}/status', [ Controller::class, 'toggleStatus' ]); Router::get('/api/v1/events/{id}/delete', [ Controller::class, 'restConfigDelete' ]); Router::delete('/api/v1/events/{id}', [ Controller::class, 'delete' ]); Hooks::add('router::get->api.v1.rest.routes', function( $routes ) { $routes[] = [ "path" => "/events", "label" => "Events", "icon" => "bi bi-ticket-detailed", "menu" => "content", ]; return $routes; }); } } /** Datei: plugins/events/library/ARUNOX/Plugins/Events/API/v1/Controller.php **/ * @copyright 2025 ARUNOX * @version 1.1.0 * * @since 1.0.0 File is created */ namespace ARUNOX\Plugins\Events\API\v1; use ARUNOX\HTTP; use ARUNOX\Core\Hooks; use ARUNOX\Plugins\REST; use ARUNOX\Plugins\Events; use ARUNOX\API\BaseController; class Controller extends BaseController { /* ### VARIABLES ################################################ # */ protected static array $NOTIFY = [ "notfound" => "Event nicht gefunden", "saved" => "Event wurde erfolgreich gespeichert", "deleted" => "Event wurde erfolgreich gelöscht", "created" => "Event wurde erfolgreich erstellt", "notcreated" => "Event konnte nicht erstellt werden", ]; /* ### PUBLIC GET FUNCTIONS ##################################### # */ public function getAll() : HTTP\Response { $results = Events\Model::getAll(); static::restConfigOverview( $results ); return REST\Response::jsonResponse(); } public function get( int $id ) : HTTP\Response { if( $result = Events\Model::get( $id ) ) { static::restConfigDetails( $result ); } else REST\Response::addNotify( "danger", static::getNotify("notfound") ); return REST\Response::jsonResponse(); } /* ### PUBLIC SAVE FUNCTIONS #################################### # */ public function save( int $id, array $data ) : HTTP\Response { if( $result = Events\Model::get( $id ) ) { $result->save( $data ); REST\Response::addNotify( "success", static::getNotify("saved") ); REST\Response::closeModals(); REST\Response::addUpdater( [ "data/table/row", $id ], $result ); } else REST\Response::addNotify( "danger", static::getNotify("notfound") ); return REST\Response::jsonResponse(); } public function create( array $data ) : HTTP\Response { if( $id = Events\Model::save( $data ) ) { REST\Response::addNotify( "success", static::getNotify("created") ); REST\Response::closeModals(); REST\Response::redirect( "/events" ); } else REST\Response::addNotify( "danger", static::getNotify("notcreated") ); return REST\Response::jsonResponse(); } public function delete( int $id ) : HTTP\Response { REST\Response::closeModals(); if( Events\Model::delete( $id ) ) { REST\Response::addNotify( "success", static::$NOTIFY["deleted"] ); REST\Response::redirect( "/events" ); } else REST\Response::addNotify( "danger", static::$NOTIFY["notfound"] ); return REST\Response::jsonResponse(); } public function toggleStatus( int $id ) : HTTP\Response { if( $result = Events\Model::get( $id ) ) { $result->toggleStatus( TRUE ); REST\Response::addUpdater( [ "data/table/row", $id ], $result ); } else REST\Response::addNotify( "danger", static::$NOTIFY["notfound"] ); return REST\Response::jsonResponse(); } /* ### PUBLIC VALIDATE FUNCTIONS ################################ # */ /* ### PUBLIC REST FUNCTIONS #################################### # */ public static function restConfigOverview( array $data = [] ) : REST\Generator\Base\BaseGenerator { return REST\Response::addWrapper( "overview", "Events" ) ->setList( $data ) ->get() ->setAction( "/events/{id}" ) ->setOrder( "title", "asc" ) ->setSearch( TRUE ) ->addButton(...Hooks::filter( "rest.generator::button.name->create", [], "events" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->status", [], "status", [], FALSE, "events" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->amount", [ "label" => NULL, "title" => "Tage", "icon" => "bi-calendar-day", ], "dates", TRUE, FALSE, TRUE, "events" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->amount", [ "label" => NULL, "title" => "Tickets", "icon" => "bi-tags", ], "tickets", TRUE, FALSE, TRUE, "events" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->amount", [ "label" => NULL, "title" => "Limit pro Tag", "icon" => "bi-people", ], "limit", TRUE, FALSE, TRUE, "events" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->amount", [ "label" => NULL, "title" => "Buchungen", "icon" => "bi-cart", ], "bookings", TRUE, FALSE, TRUE, "events" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->amount", [ "label" => NULL, "title" => "Eingescheckt", "icon" => "bi-clipboard-check", ], "checkedin", TRUE, FALSE, TRUE, "events" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->text", [], "title", TRUE, TRUE, TRUE, "events" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->datetime", [], "date_edit", FALSE, FALSE, TRUE, "events" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->actions", [], [], FALSE, "events" ))->get() ->addButton(...Hooks::filter( "rest.generator::action.name->edit", [], "events" )) ->addButton(...Hooks::filter( "rest.generator::action.name->delete", [], "events" )) ->top(); } public static function restConfigDetails( Events\Entity $data ) : REST\Generator\Base\BaseGenerator { $form = REST\Response::addWrapper( "details", "Event bearbeiten" ) ->setData( $data ) ->setBacklink( "/events" ) ->get() ->setAction( "/api/v1/events/{id}", "PUT" ) ->addTab( "Event" )->get() ->addField(...Hooks::filter( "rest.generator::control.type->text", [], "title", TRUE, "events" )) ->parent() ->addTab( "Tickets" ) ->get() ->setActive( TRUE ) ->addContent( Events\Tickets\API\v1\Controller::restConfigTable() ) ->parent() ->addTab( "Bookings" )->get() ->addContent( Events\Bookings\API\v1\Controller::restConfigTable() ) ->parent() ->addTab( "Vouchers" )->get() ->addContent( Events\Vouchers\API\v1\Controller::restConfigTable() ) ->parent() ->addTab( "Speichern" )->get() ->setColor( REST\Generator\Config\Color::Primary ) ->setIcon( "bi bi-save" ) ->setType( "submit" ); return $form; } public static function restConfigCreate() : REST\Generator\Base\BaseGenerator { return REST\Response::addModal( "details", "Event erstellen" ) ->setData([ "id" => 0 ]) ->get() ->setAction( "/api/v1/events", "POST" ) ->addButton(...Hooks::filter( "rest.generator::button.type->submit", [], "Erstellen", "events" )) ->addField(...Hooks::filter( "rest.generator::control.type->text", [], "title", TRUE, "events" )) ->top(); } public static function restConfigDelete( int $id ) : REST\Generator\Base\BaseGenerator { return REST\Response::addModal( "details", "Event Löschen" ) ->setData([ "id" => $id ]) ->setSize( REST\Wrapper\Modal\Size::sm ) ->get() ->setAction( "/api/v1/events/{id}", "DELETE" ) ->addText( "Möchtest du wirklich den Datensatz (#{$id}) löschen? " ) ->addButton(...Hooks::filter( "rest.generator::button.type->cancel", [], NULL, "events" )) ->addButton(...Hooks::filter( "rest.generator::button.type->delete", [], NULL, "events" )) ->top(); } /* ### PUBLIC REST EXTENSION FUNCTIONS ########################## # */ } /** Datei: plugins/events/library/ARUNOX/Plugins/Events/Entity.php **/ Attribute\Status::class, "date_create" => Attribute\DateTime::class, "date_edit" => Attribute\DateTime::class, "tickets" => "countTickets", "bookings" => "countBookings", "dates" => "countDates", ]; /* ### PUBLIC FUNCTIONS ######################################### # */ public function toggleStatus( bool $save = FALSE ) { $this->status->toggle(); if( $save ) $this->save(); } public function countTickets() { $tickets = Tickets\Model::getByEventId( $this->id ); return count( $tickets ); } public function countBookings() { $bookings = Bookings\Model::getByEventId( $this->id ); return count( $bookings ); } public function countDates() { $dates = []; $tickets = Tickets\Model::getByEventId( $this->id ); foreach( $tickets as $ticket ) { $dates[] = $ticket->date_start->date(); } $dates = array_filter( $dates ); $dates = array_unique( $dates ); return count( $dates ); } /* ### MAGIC FUNCTIONS ########################################## # */ } /** Datei: plugins/events/library/ARUNOX/Plugins/Events/Tickets/Model.php **/ * @copyright 2025 ARUNOX * @version 1.1.0 * * @since 1.0.0 File is created */ namespace ARUNOX\Plugins\Events\Tickets\API\v1; use ARUNOX\Core\Hooks; use ARUNOX\Core\Router; use ARUNOX\Plugins\Users; class Routes { public static function register() : void { Router::get('/api/v1/events/{id}/tickets', [ Controller::class, 'getByEventId' ]); Router::get('/api/v1/events/{id}/tickets/create', [ Controller::class, 'restConfigCreate' ]); Router::post('/api/v1/events/{id}/tickets', [ Controller::class, 'create' ]); Router::get('/api/v1/events/{id}/tickets/{id}', [ Controller::class, 'get' ]); Router::put('/api/v1/events/{id}/tickets/{id}', [ Controller::class, 'save' ]); Router::patch('/api/v1/events/{id}/tickets/{id}/status', [ Controller::class, 'toggleStatus' ]); Router::patch('/api/v1/events/{id}/tickets/{id}/age_check',[ Controller::class, 'toggleAgeCheck' ]); Router::get('/api/v1/events/{id}/tickets/{id}/delete', [ Controller::class, 'restConfigDelete' ]); Router::delete('/api/v1/events/{id}/tickets/{id}', [ Controller::class, 'delete' ]); Hooks::add('router::get->api.v1.rest.routes', function( $routes ) { $routes[] = [ "path" => "/events/tickets/{id}", "label" => "Bearbeiten", ]; return $routes; }); } } /** Datei: plugins/events/library/ARUNOX/Plugins/Events/Tickets/API/v1/Controller.php **/ * @copyright 2025 ARUNOX * @version 1.1.0 * * @since 1.0.0 File is created */ namespace ARUNOX\Plugins\Events\Tickets\API\v1; use ARUNOX\HTTP; use ARUNOX\Core\Hooks; use ARUNOX\Plugins\REST; use ARUNOX\Plugins\Events; use ARUNOX\API\BaseController; class Controller extends BaseController { /* ### VARIABLES ################################################ # */ protected static array $NOTIFY = [ "notfound" => "Ticket nicht gefunden", "saved" => "Ticket wurde erfolgreich gespeichert", "deleted" => "Ticket wurde erfolgreich gelöscht", "created" => "Ticket wurde erfolgreich erstellt", "notcreated" => "Ticket konnte nicht erstellt werden", ]; /* ### PUBLIC FUNCTIONS ######################################### # */ public function getByEventId( int $id ) : HTTP\Response { $results = Events\Tickets\Model::getByEventId( $id ); return $this->jsonResponse( $results ); } public function get( int $origin, int $id ) : HTTP\Response { if( $result = Events\Tickets\Model::get([ "id" => $id, "origin_id" => $origin ]) ) { static::restConfigDetails( $result ); } else REST\Response::addNotify( "danger", static::getNotify("notfound") ); return REST\Response::jsonResponse(); } /* ### PUBLIC SAVE FUNCTIONS #################################### # */ public function save( int $origin, int $id, array $data ) : HTTP\Response { if( $result = Events\Tickets\Model::get([ "id" => $id, "origin_id" => $origin ]) ) { $result->save( $data ); REST\Response::addNotify( "success", static::getNotify("saved") ); REST\Response::closeModals(); REST\Response::addUpdater( [ "data/table/row", "/api/v1/events/{$result->origin_id}/tickets", $id ], $result ); } else REST\Response::addNotify( "danger", static::getNotify("notfound") ); return REST\Response::jsonResponse(); } public function create( int $origin, array $data ) : HTTP\Response { $data[ "origin_id" ] = $origin; if( $id = Events\Tickets\Model::save( $data ) ) { $result = Events\Tickets\Model::get( $id ); REST\Response::addNotify( "success", static::getNotify("created") ); REST\Response::closeModals(); REST\Response::redirect( "/events/{$result->origin_id}#tickets" ); } else REST\Response::addNotify( "danger", static::getNotify("notcreated") ); return REST\Response::jsonResponse(); } public function delete( int $origin, int $id ) : HTTP\Response { $result = Events\Tickets\Model::get([ "id" => $id, "origin_id" => $origin ]); REST\Response::closeModals(); if( $result && Events\Tickets\Model::delete( $id ) ) { REST\Response::addNotify( "success", static::getNotify("deleted") ); REST\Response::redirect( "/events/{$result->origin_id}#tickets" ); } else REST\Response::addNotify( "danger", static::getNotify("notfound") ); return REST\Response::jsonResponse(); } public function toggleStatus( int $origin, int $id ) : HTTP\Response { if( $result = Events\Tickets\Model::get([ "id" => $id, "origin_id" => $origin ]) ) { $result->toggleStatus( TRUE ); REST\Response::addUpdater( [ "data/table/row", "/api/v1/events/{$result->origin_id}/tickets", $id ], $result ); } else REST\Response::addNotify( "danger", static::getNotify("notfound") ); return REST\Response::jsonResponse(); } public function toggleAgeCheck( int $origin, int $id ) : HTTP\Response { if( $result = Events\Tickets\Model::get([ "id" => $id, "origin_id" => $origin ]) ) { $result->toggleAgeCheck( TRUE ); REST\Response::addUpdater( [ "data/table/row", "/api/v1/events/{$result->origin_id}/tickets", $id ], $result ); } else REST\Response::addNotify( "danger", static::getNotify("notfound") ); return REST\Response::jsonResponse(); } /* ### PUBLIC VALIDATE FUNCTIONS ################################ # */ /* ### PUBLIC REST FUNCTIONS #################################### # */ public static function restConfigDetails( ?Events\Tickets\Entity $data = NULL ) : REST\Generator\Base\BaseGenerator { return REST\Response::addModal( "details", "Ticket bearbeiten" ) ->setData( $data ) ->get() ->setAction( "/api/v1/events/{origin_id}/tickets/{id}", "PUT" ) ->addButton(...Hooks::filter( "rest.generator::button.type->submit", [], "Speichern", "events/{origin_id}/tickets" )) ->addText( "Geben Sie diesem Ticket eine für Sie passende Beschreibung, zur besseren Wiedererkennung." ) ->addField(...Hooks::filter( "rest.generator::control.type->text", [], "title", TRUE, "events/{origin_id}/tickets" )) ->addHeadline( "Zeiten", "3" ) ->addField(...Hooks::filter( "rest.generator::control.type->datetime", [], "date_start", TRUE, "events/{origin_id}/tickets" )) ->addField(...Hooks::filter( "rest.generator::control.type->datetime", [], "date_end", TRUE, "events/{origin_id}/tickets" )) ->addHeadline( "Einstellungen", "3" ) ->addField(...Hooks::filter( "rest.generator::control.type->select", [ "label" => "Altersprüfung", "options" => Events\Tickets\AgeCheck::getAll(), ], "age_check", TRUE, TRUE, "events/{origin_id}/tickets" )) ->addField(...Hooks::filter( "rest.generator::control.type->number", [], "age_limit", TRUE, "events/{origin_id}/tickets" )) ->addField(...Hooks::filter( "rest.generator::control.type->number", [], "limit", TRUE, "events/{origin_id}/tickets" )); } public static function restConfigCreate( ...$args ) : REST\Generator\Base\BaseGenerator { return static::restConfigDetails() ->top() ->setTitle( "Ticket erstellen" ) ->getContent() ->setAction( "/api/v1/events/{$args[0]}/tickets", "POST" ) ->getButtons() ->setLabel( "Erstellen" ); } public static function restConfigDeleteOwn( int $origin, int $id ) : REST\Generator\Base\BaseGenerator { return REST\Response::addModal( "details", "Ticket Löschen" ) ->setData([ "id" => $id, "origin_id" => $origin ]) ->setSize( REST\Wrapper\Modal\Size::sm ) ->get() ->setAction( "/api/v1/events/{origin_id}/tickets/{id}", "DELETE" ) ->addText( "Möchtest du wirklich den Datensatz (#{$id}) löschen? " ) ->addButton(...Hooks::filter( "rest.generator::button.type->cancel", [], NULL, "events/{origin_id}/tickets" )) ->addButton(...Hooks::filter( "rest.generator::button.type->delete", [], NULL, "events/{origin_id}/tickets" )); } public static function restConfigTable() : REST\Generator\Base\BaseGenerator { $table = REST\Generator\Data\Table::create() ->setApi( "/api/v1/events/{id}/tickets" ) ->setAction( "/api/v1/events/{origin_id}/tickets/{id}" ) ->setOrder( "name", "asc" ) ->setSearch( TRUE ) ->addButton(...Hooks::filter( "rest.generator::button.name->create", [], "events/{id}/tickets" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->date", [ "label" => "Datum" ], "date_start", TRUE, FALSE, TRUE, "events/{origin_id}/tickets" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->time", [ "label" => "Beginn" ], "date_start", TRUE, FALSE, TRUE, "events/{origin_id}/tickets" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->time", [ "label" => "Ende" ], "date_end", TRUE, FALSE, TRUE, "events/{origin_id}/tickets" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->status", [], "status", [], "events/{origin_id}/tickets" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->status", [ "label" => "Altersprüfung", "icon" => "bi-person-gear", "options" => Events\Tickets\AgeCheck::getAll(), ], "age_check", [], "events/{origin_id}/tickets" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->amount", [ "label" => NULL, "title" => "Alterslimit", "icon" => "bi-person-slash", ], "age_limit", TRUE, FALSE, TRUE, "events/{origin_id}/tickets" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->amount", [ "label" => NULL, "title" => "Personen je Ticket", "icon" => "bi-people", ], "limit", TRUE, FALSE, TRUE, "events/{origin_id}/tickets" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->amount", [ "label" => NULL, "title" => "Buchungen", "icon" => "bi-cart", ], "bookings", TRUE, FALSE, TRUE, "events/{origin_id}/tickets" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->amount", [ "label" => NULL, "title" => "Eingescheckt", "icon" => "bi-clipboard-check", ], "checkedin", TRUE, FALSE, TRUE, "events/{origin_id}/tickets" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->text", [], "title", TRUE, TRUE, TRUE, "events/{origin_id}/tickets" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->datetime", [], "date_edit", FALSE, FALSE, TRUE, "events/{origin_id}/tickets" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->actions", [], [], FALSE, "events/{origin_id}/tickets" ))->get() ->addButton(...Hooks::filter( "rest.generator::action.name->execute", [ "label" => "Buchungen anzeigen", "color" => REST\Generator\Config\Color::Secondary, "icon" => "bi bi-list-columns", "action" => "/events/{origin_id}#bookings?ticket.id={id}", ], "events/{origin_id}/bookings" )) ->addButton(...Hooks::filter( "rest.generator::action.name->edit", [], "events/{origin_id}/tickets" )) ->addButton(...Hooks::filter( "rest.generator::action.name->delete", [], "events/{origin_id}/tickets" )) ->top(); // $buttons = $table->getButtons(); // // foreach( Events\Tickets\Type::getAll() as $type ) { // $type["name"] = "type"; // // $buttons[0]->addDropdown( ...Hooks::filter( "rest.generator::button.name->create", $type, "events/{id}/tickets" ) ); // } return $table; } } /** Datei: plugins/events/library/ARUNOX/Plugins/Events/Tickets/Entity.php **/ Attribute\Status::class, "date_start" => Attribute\DateTime::class, "date_end" => Attribute\DateTime::class, "age_check" => AgeCheck::class, "bookings" => "countBookings", ]; /* ### PUBLIC FUNCTIONS ######################################### # */ public function toggleStatus( bool $save = FALSE ) { $this->status->toggle(); if( $save ) $this->save(); } public function toggleAgeCheck( bool $save = FALSE ) { $this->age_check->toggle(); if( $save ) $this->save(); } public function countBookings() { $bookings = Bookings\Model::getByTicketId( $this->id ); return count( $bookings ); } /* ### MAGIC FUNCTIONS ########################################## # */ } /** Datei: plugins/events/library/ARUNOX/Plugins/Events/Tickets/AgeCheck.php **/ [ "color" => REST\Generator\Config\Color::Danger, "label" => "For all", "icon" => "bi bi-people" ], 1 => [ "color" => REST\Generator\Config\Color::Success, "label" => "At least one", "icon" => "bi bi-person" ], ]; /* ### PUBLIC FUNCTIONS ######################################### # */ public function toggle() { $options = static::getConstants(); $options = array_flip( $options ); if( !is_numeric( $this->value ) ) { $this->value = (int)$this->value; } $this->value++; if( $this->value > array_key_last( $options ) ) { $this->value = array_key_first( $options ); } return $this->value; } /* ### MAGIC FUNCTIONS ########################################## # */ } /** Datei: plugins/events/hooks/config.php **/ * @copyright 2025 ARUNOX * @version 1.0.0 * @since 1.0.0 File is created */ use ARUNOX\Core\Hooks; use ARUNOX\Plugins\Settings; // Hooks::add('config::constants', function() { // define( "TEMPLATE_CONSTANT", Hooks::filter( 'config::constants->TEMPLATE_CONSTANT', FALSE ) ); // }); // // Hooks::add( 'config::constants.type->TEMPLATE_CONSTANT', function( $type ) { return Settings\Type::Unknown; }); /** Datei: plugins/events/config.php **/ * @copyright 2025 ARUNOX * @version 1.0.0 * @since 1.0.0 File is created */ /** Datei: plugins/events/config/schema/v1.0.0.php **/ array ( 'columns' => array ( 'id' => 'INT NOT NULL AUTO_INCREMENT', 'date_create' => 'DATETIME DEFAULT_GENERATED DEFAULT \'CURRENT_TIMESTAMP\'', 'date_edit' => 'DATETIME DEFAULT_GENERATED ON UPDATE CURRENT_TIMESTAMP DEFAULT \'CURRENT_TIMESTAMP\'', 'status' => 'TINYINT(1) DEFAULT \'0\'', 'title' => 'VARCHAR(255)', ), 'primary' => array ( 0 => 'id', ), 'indexes' => array ( ), 'engine' => 'InnoDB', 'charset' => 'utf8mb3', ), 'events_bookings' => array ( 'columns' => array ( 'id' => 'INT NOT NULL AUTO_INCREMENT', 'date_create' => 'DATETIME DEFAULT_GENERATED DEFAULT \'CURRENT_TIMESTAMP\'', 'date_edit' => 'DATETIME DEFAULT_GENERATED ON UPDATE CURRENT_TIMESTAMP DEFAULT \'CURRENT_TIMESTAMP\'', 'status' => 'TINYINT(1) DEFAULT \'0\'', 'firstname' => 'VARCHAR(255)', 'lastname' => 'VARCHAR(255)', 'email' => 'VARCHAR(255)', 'birthdate' => 'DATE', 'ticket_id' => 'INT', 'voucher_id' => 'VARCHAR(6)', 'date_checkin' => 'DATETIME', ), 'primary' => array ( 0 => 'id', ), 'indexes' => array ( 'events_sales_uindex' => array ( 0 => 'firstname', 1 => 'lastname', 2 => 'email', 3 => 'voucher_id', 4 => 'ticket_id', ), ), 'engine' => 'InnoDB', 'charset' => 'utf8mb3', ), 'events_meta' => array ( 'columns' => array ( 'id' => 'INT NOT NULL AUTO_INCREMENT', 'date_create' => 'DATETIME DEFAULT_GENERATED DEFAULT \'CURRENT_TIMESTAMP\'', 'date_edit' => 'DATETIME DEFAULT_GENERATED ON UPDATE CURRENT_TIMESTAMP DEFAULT \'CURRENT_TIMESTAMP\'', 'origin_id' => 'INT NOT NULL', 'meta_key' => 'VARCHAR(255) NOT NULL', 'meta_value' => 'TEXT', ), 'primary' => array ( 0 => 'id', ), 'indexes' => array ( 'origin_id' => array ( 0 => 'origin_id', 1 => 'meta_key', ), ), 'engine' => 'InnoDB', 'charset' => 'utf8mb3', ), 'events_tickets' => array ( 'columns' => array ( 'id' => 'INT NOT NULL AUTO_INCREMENT', 'date_create' => 'DATETIME DEFAULT_GENERATED DEFAULT \'CURRENT_TIMESTAMP\'', 'date_edit' => 'DATETIME DEFAULT_GENERATED ON UPDATE CURRENT_TIMESTAMP DEFAULT \'CURRENT_TIMESTAMP\'', 'date_start' => 'DATETIME', 'date_end' => 'DATETIME', 'origin_id' => 'INT', 'status' => 'TINYINT(1) DEFAULT \'0\'', 'title' => 'VARCHAR(255) NOT NULL', 'restriction' => 'TINYINT(1) DEFAULT \'0\'', ), 'primary' => array ( 0 => 'id', ), 'indexes' => array ( ), 'engine' => 'InnoDB', 'charset' => 'utf8mb3', ), 'events_tickets_meta' => array ( 'columns' => array ( 'id' => 'INT NOT NULL AUTO_INCREMENT', 'date_create' => 'DATETIME DEFAULT_GENERATED DEFAULT \'CURRENT_TIMESTAMP\'', 'date_edit' => 'DATETIME DEFAULT_GENERATED ON UPDATE CURRENT_TIMESTAMP DEFAULT \'CURRENT_TIMESTAMP\'', 'origin_id' => 'INT NOT NULL', 'meta_key' => 'VARCHAR(255) NOT NULL', 'meta_value' => 'TEXT', ), 'primary' => array ( 0 => 'id', ), 'indexes' => array ( 'origin_id' => array ( 0 => 'origin_id', 1 => 'meta_key', ), ), 'engine' => 'InnoDB', 'charset' => 'utf8mb3', ), 'events_vouchers' => array ( 'columns' => array ( 'uuid' => 'VARCHAR(6) NOT NULL', 'date_create' => 'DATETIME DEFAULT_GENERATED DEFAULT \'CURRENT_TIMESTAMP\'', 'date_edit' => 'DATETIME DEFAULT_GENERATED ON UPDATE CURRENT_TIMESTAMP DEFAULT \'CURRENT_TIMESTAMP\'', 'date_use' => 'DATETIME', 'type' => 'TINYINT(1) DEFAULT \'0\'', 'identifier' => 'VARCHAR(255)', 'ticket_ids' => 'LONGTEXT', ), 'primary' => array ( 0 => 'uuid', ), 'indexes' => array ( ), 'engine' => 'InnoDB', 'charset' => 'utf8mb3', ), );