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.
28 lines
608 B
PHP
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'));
|
|
}
|
|
}
|