Files
sirpremiumv2/app/Http/Livewire/ShareCodeComponent.php
T
Juan Felipe Duarte a558e393f2 Add rank management feature with CRUD and UI
Introduces a new rank management system including the Rank model, migrations for the ranks table and user IP address, Livewire components for managing and displaying ranks, and related Blade views. Updates navigation and routes to include the new 'Gestión Rangos' section, and enhances the ShareCodeComponent with user data. Also adds a reusable input field component for forms.
2025-10-23 20:28:47 -05:00

28 lines
608 B
PHP

<?php
namespace App\Http\Livewire;
use Illuminate\Support\Facades\Auth;
use Livewire\Component;
class ShareCodeComponent extends Component
{
public $user;
public function mount()
{
$this->user = Auth::user();
}
public function render()
{
$referrals = Auth::user()->children()
->select('*')
->selectRaw('(SELECT COUNT(*) FROM users u WHERE u.parent_id = users.id::text) as children_count')
->orderBy('created_at', 'desc')
->get();
return view('livewire.share-code-component', compact('referrals'));
}
}