| Server IP : 208.122.213.31 / Your IP : 216.73.216.45 Web Server : Apache System : Linux msd6191.mjhst.com 4.18.0-553.137.1.el8_10.x86_64 #1 SMP Wed Jun 24 11:40:24 UTC 2026 x86_64 User : WHMCS_MIA_382 ( 1001) PHP Version : 7.4.33 Disable Function : NONE MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/httpd/html/lcmsmodels.com/public_html/app/Http/Livewire/ |
Upload File : |
<?php
namespace App\Http\Livewire;
use Livewire\Component;
use App\Profile;
use Overtrue\LaravelFollow\Events\Followed;
class Followbutton extends Component
{
public $profileId;
public function mount($profileId)
{
$this->profileId = $profileId;
}
public function getProfileProperty()
{
return Profile::findOrFail($this->profileId);
}
public function render()
{
return view('livewire.followbutton');
}
public function toggleFollow()
{
if (!auth()->check())
return redirect(route('login'));
if (auth()->user()->id != $this->profile->user->id) {
// toggle follow
$follow = auth()->user()->toggleFollow($this->profile->user);
// notify user
if (!is_null($follow))
return event(new Followed($follow));
return $follow;
} else {
$this->emit('swal', [
'type' => 'error',
'title' => '',
'message' => __('profile.followSelf'),
]);
}
}
}