forge/app/Livewire/UserStack.php

33 lines
540 B
PHP
Raw Normal View History

2024-08-29 16:25:55 -04:00
<?php
namespace App\Livewire;
2024-08-29 21:50:59 -04:00
use Illuminate\Support\Facades\Auth;
2024-08-29 16:25:55 -04:00
use Livewire\Component;
class UserStack extends Component
{
public $users;
public string $label = 'Users';
public int $limit = 5;
2024-08-29 21:50:59 -04:00
public bool $viewAll = false;
2024-08-29 16:25:55 -04:00
public function render()
{
return view('livewire.user-stack');
}
2024-08-29 21:50:59 -04:00
public function toggleViewAll()
{
$this->viewAll = ! $this->viewAll;
}
public function followUser($user)
{
$user->followers->syncWithoutDetaching(Auth::id());
}
2024-08-29 16:25:55 -04:00
}