forge/app/Livewire/UserStack.php

39 lines
640 B
PHP
Raw Normal View History

2024-08-29 16:25:55 -04:00
<?php
namespace App\Livewire;
use App\Models\User;
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)
2024-08-29 21:50:59 -04:00
{
Auth::user()->follow($user);
}
public function unfollowUser(User $user)
{
Auth::user()->unfollow($user);
2024-08-29 21:50:59 -04:00
}
2024-08-29 16:25:55 -04:00
}