Sounds like you arent signed in
Add the auth middleware to the route you are visiting (in web.php)
->middleware('auth')
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
im learning livewire form
until chrome said Cannot assign null to property App\Livewire\EditProfile::$user of type App\Models\User
the intelephense keep showing and underline the user() and saying undefined method 'user' on $this-> user = auth()->user();
already tried this https://stackoverflow.com/questions/65042816/undefined-functions-methods-intelephense1013-laravel-homestead-vscode
still stuck the browser keep saying
Cannot assign null to property App\Livewire\EditProfile::$user of type App\Models\User
the component EditProfile
<?php
namespace App\Livewire;
use App\Models\User;
use Livewire\Component;
class EditProfile extends Component
{
public User $user;
public $username = '';
public $bio = '';
public function mount()
{
$this-> user = auth()->user();
$this->username = $this->user->username;
$this->bio = $this->user->bio;
}
public function render()
{
return view('livewire.edit-profile');
}
}
Sounds like you arent signed in
Add the auth middleware to the route you are visiting (in web.php)
->middleware('auth')
Please or to participate in this conversation.