Skip to main content

Admin-Organizer Linking Commands

This document describes the commands and services available for linking the administrator user with an organizer account in the system.

🎯 Purpose

The system allows linking the existing administrator user (created by the UsersSeed seeder) with an organizer account so they can manage events and access organizer-specific functionality.

🛠️ Available Commands

Main command for managing the link between admin and organizer.

Syntax

Available Actions

1. Link - Link admin with organizer
Functionality:
  • Looks up the existing admin user (a-oceanman@mail.com)
  • Creates a new organizer or reuses an existing one
  • Assigns the first available tariff in the system
  • Links the admin with the organizer
  • Shows detailed information about the process
2. Status - Check current status
Functionality:
  • Checks whether the admin is linked to an organizer
  • Shows information about the associated organizer
  • Provides details of the link status
3. Unlink - Unlink admin from the organizer
Functionality:
  • Unlinks the admin from the current organizer
  • Keeps the organizer in the system
  • Clears the reference on the admin user

🌱 Seeder: AdminOrganizerLinkSeed

Automatic seeder to link admin with organizer during installation.

Usage

Functionality

  • Checks the current link status
  • Performs the link if not already linked
  • Shows informational messages about the process
  • Prevents duplicates

🔧 Service: AdminOrganizerLinkService

Internal service that handles all the linking logic.

Main Methods

linkAdminWithOrganizer($organizerName = null)

getAdminOrganizerStatus()

unlinkAdminFromOrganizer()

📋 Prerequisites

1. Existing Admin User

  • The admin user must exist (created by UsersSeed)
  • Email: a-oceanman@mail.com
  • Password: oceanman

2. Available Tariffs

  • At least one tariff must exist in the system
  • Tariffs are created automatically with TarifasSeed

3. Database

  • users table with the organizador_id field
  • organizadores table with all required fields
  • tarifas table with at least one record

🔍 Status Verification

Before Linking

After Linking

Verify in the Database

🚨 Troubleshooting

Error: “Admin user not found”

  • Verify that UsersSeed has been run
  • Confirm that a user exists with the email a-oceanman@mail.com

Error: “No tarifas available in the system”

  • Run TarifasSeed to create tariffs
  • Verify that active tariffs exist in the tarifas table

Error: “Field ‘tarifas_id’ doesn’t have a default value”

  • Verify that the Organizador model has tarifas_id in $fillable
  • Confirm that the tarifas_id migration has been run

Error: “Admin user is already linked”

  • The admin is already linked to an organizer
  • Use status to check the current status
  • Use unlink if you want to change the link

📝 Logs and Auditing

The service logs all operations in Laravel’s logs:

Initial Installation

  1. Run migrations: php artisan migrate
  2. Run basic seeds: php artisan db:seed --class=UsersSeed
  3. Run tariff seeds: php artisan db:seed --class=TarifasSeed
  4. Link admin: php artisan admin:link-organizer link

Post-Installation Verification

  1. Check status: php artisan admin:link-organizer status
  2. Test login with admin in the system
  3. Confirm access to organizer functionality

Maintenance

  • Use status to verify the link
  • Use unlink and link to change the organizer if needed
  • Review logs periodically for auditing

📞 Support

For issues or questions about the admin-organizer link:
  1. Check logs at storage/logs/laravel.log
  2. Run php artisan admin:link-organizer status
  3. Review this document for troubleshooting
  4. Contact the development team if issues persist