Neeraj1005
1 month ago
257
5
Laravel

Undefined variable: profileinfo (View: C:\laragon\www\acl\resources\views\components\auth-user-info.blade.php) (View: C:\laragon\www\acl\resources\views\components\auth-user-info.blade.php)

Posted 1 month ago by Neeraj1005

In my project, I have just passed the variable in blade compoent like this controller

    public function index()
    {
        $profileinfo = Auth::user();

        return view('userprofile.profile-page', compact('profileinfo'));
    }

blade resources\views\userprofile\profile-page.blade.php

<div class="container">

    <h1 class="h3 mb-3">Profile Information</h1>

    <div class="row">

        <div class="col-md-5 col-xl-4">

            <x-auth-user-info :profileinfo="$profileinfo" />

        </div> <!-- end col-md-5 col-xl-4 -->
</div>

and this is the component resources\views\components\auth-user-info.blade.php

<div>
    <div class="card-box text-center">
        <img src="{{ $profileinfo->profile_photo_url }}" class="rounded-circle avatar-xl img-thumbnail" alt="profile-image">
</div>
</div>

can anyone tell me why this throw an error. did i something wrong in component?

Please sign in or create an account to participate in this conversation.