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 theUsersSeed seeder) with an organizer account so they can manage events and access organizer-specific functionality.
🛠️ Available Commands
Artisan Command: admin:link-organizer
Main command for managing the link between admin and organizer.
Syntax
Available Actions
1. Link - Link admin with organizer
- 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
- 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
- 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
userstable with theorganizador_idfieldorganizadorestable with all required fieldstarifastable with at least one record
🔍 Status Verification
Before Linking
After Linking
Verify in the Database
🚨 Troubleshooting
Error: “Admin user not found”
- Verify that
UsersSeedhas been run - Confirm that a user exists with the email
a-oceanman@mail.com
Error: “No tarifas available in the system”
- Run
TarifasSeedto create tariffs - Verify that active tariffs exist in the
tarifastable
Error: “Field ‘tarifas_id’ doesn’t have a default value”
- Verify that the
Organizadormodel hastarifas_idin$fillable - Confirm that the
tarifas_idmigration has been run
Error: “Admin user is already linked”
- The admin is already linked to an organizer
- Use
statusto check the current status - Use
unlinkif you want to change the link
📝 Logs and Auditing
The service logs all operations in Laravel’s logs:🔄 Recommended Workflow
Initial Installation
- Run migrations:
php artisan migrate - Run basic seeds:
php artisan db:seed --class=UsersSeed - Run tariff seeds:
php artisan db:seed --class=TarifasSeed - Link admin:
php artisan admin:link-organizer link
Post-Installation Verification
- Check status:
php artisan admin:link-organizer status - Test login with admin in the system
- Confirm access to organizer functionality
Maintenance
- Use
statusto verify the link - Use
unlinkandlinkto change the organizer if needed - Review logs periodically for auditing
📞 Support
For issues or questions about the admin-organizer link:- Check logs at
storage/logs/laravel.log - Run
php artisan admin:link-organizer status - Review this document for troubleshooting
- Contact the development team if issues persist
