Skip to main content

Overview

The Company Insights module provides developers with a bird’s-eye view of all companies using ElectroFix AI. Monitor subscriptions, view company details, track user counts, and access individual company data for support and administrative purposes.
This module is only accessible to users with the developer role. Admins and workers cannot access Company Insights, even for their own company.

What You Can Do

  • View list of all subscribed companies
  • See subscription plans and validity periods
  • Review company contact information
  • View user counts per company
  • Access detailed company profiles
  • Monitor subscription status across the platform

Accessing Company Insights

As a developer, navigate to:
  • DeveloperCompanies from the main menu
  • Direct URL: /developer/companies
The companies index page displays a table of all companies in the system.

Companies List View

The main view shows all companies with key information:

Table Columns

Empresa (Company)
  • Company name from company settings
  • Links to detailed company view
Plan
  • Current subscription plan (STARTER, PRO, ENTERPRISE, DEVELOPER_TEST)
  • Displays “N/A” if no subscription exists
  • Uppercase text for easy scanning
Vigencia (Validity)
  • Subscription date range
  • Format: YYYY-MM-DD - YYYY-MM-DD
  • Start date to end date
  • Blank if no subscription
Dueño (Owner)
  • Owner name from company settings
  • Primary contact person
Contacto (Contact)
  • Owner email (primary line)
  • Owner phone (secondary line, smaller text)
  • For reaching company administrators
Actions
  • Detalle button: Opens detailed company view

Sorting and Display

Companies are sorted alphabetically by name (ORDER BY name ASC) for easy lookup.

Viewing Company Details

Click Detalle on any company to open the detailed view:

Company Detail Sections

Owner & Contact

Contact Information
  • Owner name
  • Owner email
  • Owner phone
  • Billing email
  • Billing phone
All contact points for the company.

Subscription

Plan Details
  • Plan level (STARTER, PRO, etc.)
  • Status (ACTIVE, TRIAL, etc.)
  • Start date
  • End date
  • Billing cycle (monthly/yearly)
Complete subscription information.

Users Section

The detail view includes a list of all users belonging to the company:
  • User name
  • Role (admin, worker, developer)
  • Email address
Format: Name (role) - email@example.com Example:
Carlos Mendoza (admin) - carlos@company.com
María Fernández (worker) - maria@company.com
Juan Pérez (worker) - juan@company.com
This helps identify:
  • Total user count
  • Admin vs. worker distribution
  • Active team members
  • Account access points

Use Cases

When a company contacts support:
  1. Search for company by name
  2. View detailed company page
  3. Check subscription status and plan
  4. Verify user count and roles
  5. Confirm contact information
  6. Provide informed assistance
Regular monitoring tasks:
  • Identify expiring subscriptions
  • Find companies still on trial
  • Check for past-due accounts
  • Verify plan distribution
  • Track growth metrics
Administrative tasks:
  • Verify company details before manual changes
  • Confirm owner contact before account actions
  • Check user counts against subscription limits
  • Validate billing information
Understanding the platform:
  • Count companies per plan tier
  • Track subscription status distribution
  • Monitor average users per company
  • Identify upgrade opportunities

Special Developer Company

There’s a special test company available:

ElectroFix Developer Lab

Accessible via:
  • Navigation: DeveloperTest Company
  • Direct URL: /developer/test-company
This company is designated for:
  • Internal testing
  • Feature demonstrations
  • QA validation
  • Training purposes
Characteristics:
  • Name: “ElectroFix Developer Lab”
  • Typically has developer_test subscription plan
  • May have unlimited or high user limits
  • Contains test data
The test company view uses the same template as regular company details but is specifically filtered to show only the “ElectroFix Developer Lab” company.

Data Visible to Developers

Full Access

Developers can see:
  • All companies regardless of subscription status
  • All company settings and configurations
  • All user accounts within companies
  • All subscription details
  • Complete contact information

Read-Only Nature

The Company Insights interface is view-only:
  • Cannot edit company settings from this interface
  • Cannot modify subscriptions directly
  • Cannot create or delete users
  • Cannot access company’s operational data (orders, customers, etc.)
For modifications:
  • Log in as admin of the target company
  • Use standard admin interfaces
  • Or use direct database access (with proper authorization)

Data Scope

Unlike admins and workers who see only their company’s data, developers see:

Global Visibility

// Admins and Workers
->where('company_id', $user->company_id)

// Developers
// No company_id filter, sees all records
This applies to:
  • Company list (all companies)
  • Subscription views (all subscriptions)
  • User lists (all users, grouped by company)
Operational modules (Orders, Customers, Equipment, etc.) still respect company scoping even for developers, unless explicitly coded otherwise.

Best Practices

Company Insights is for:
  • Platform-level monitoring
  • Support requests
  • Subscription management
  • Analytics and reporting
Not for:
  • Day-to-day development
  • Testing features (use test company)
  • Customer data access (respect privacy)
Even with full access:
  • View only what’s needed for task at hand
  • Don’t share company data unnecessarily
  • Log access for audit purposes
  • Follow data protection regulations
  • Document reason for accessing company data
When making database changes:
  1. Check Company Insights first
  2. Verify current subscription state
  3. Confirm user count and roles
  4. Note contact information
  5. Document change reason
  6. Test on test company first if possible
Monitor for:
  • Subscriptions expiring in 7 days
  • Companies stuck on trial > 60 days
  • Accounts with “past_due” status
  • Companies at user limits
  • Unusual subscription patterns
Reach out proactively before issues escalate.

Troubleshooting

Cannot Access Company Insights

Cause: Only developer role has access. Solution:
  • Verify your user record has role = 'developer'
  • Admins and workers cannot access these pages
  • Contact system administrator to grant developer role
  • Developer role is typically not granted through UI

Company Not in List

Possible Causes:
  • Company was recently created (refresh page)
  • Company was deleted
  • Database connection issue
Solution:
  1. Refresh the page
  2. Check database directly for company record
  3. Verify company hasn’t been soft-deleted
  4. Check application logs for errors

Subscription Shows “N/A”

Cause: Company has no subscription record. Solution:
  • Company was created but never accessed Subscription page
  • Subscription record was deleted
  • Have admin log in and visit Admin → Subscription
  • System will auto-create default trial subscription

Users List Empty

Cause: Company has no users associated. Solution:
  • Check if company was created without admin user
  • Verify users have correct company_id
  • May indicate orphaned company record
  • Check user creation process

Technical Reference

Routes

  • Index: GET /developer/companies - List all companies
  • Show: GET /developer/companies/{company} - Company detail view
  • Test Company: GET /developer/test-company - View ElectroFix Developer Lab
  • Subscriptions: GET /developer/subscriptions - Alternative view (same data, different route)

Controller: CompanyInsightsController

public function index()
{
    $companies = Company::query()
        ->with(['subscription', 'users'])
        ->orderBy('name')
        ->get();

    return view('developer.companies.index', [
        'currentPage' => 'developer-companies',
        'companies' => $companies,
    ]);
}

public function show(Company $company)
{
    $company->load(['subscription', 'users']);

    return view('developer.companies.show', [
        'currentPage' => 'developer-companies',
        'company' => $company,
    ]);
}

public function testCompany()
{
    $company = Company::query()
        ->where('name', 'ElectroFix Developer Lab')
        ->with(['subscription', 'users'])
        ->firstOrFail();

    return view('developer.companies.show', [
        'currentPage' => 'developer-test-company',
        'company' => $company,
    ]);
}

Authorization

Routes are protected by middleware:
Route::middleware(['auth', 'ensure.role:developer'])
    ->prefix('developer')
    ->group(function () {
        // Company Insights routes
    });
Only users with role === 'developer' can access.

Data Loading

Queries use eager loading to prevent N+1 problems:
->with(['subscription', 'users'])
Loads:
  • Company record
  • Associated subscription (if exists)
  • All users belonging to company
In single query set for optimal performance.

Views

  • Index: resources/views/developer/companies/index.blade.php
  • Show: resources/views/developer/companies/show.blade.php
Both views display company and subscription data with professional formatting.

Future Enhancements

Potential additions to Company Insights:
  • Search and Filtering: Find companies by name, plan, or status
  • Export Capabilities: Download company list as CSV/Excel
  • Usage Analytics: See AI query consumption per company
  • Activity Logs: Track last login, order creation, etc.
  • Billing History: View payment records and invoices
  • Quick Actions: Reset passwords, extend trials, upgrade plans
  • Alerts: Automated notifications for subscription events
  • Charts and Graphs: Visual analytics of platform usage
Check future updates for these features.

Build docs developers (and LLMs) love