BenBermingham
8 months ago

Pulling data from table based on ID

Posted 8 months ago by BenBermingham

Hello there,

I am trying to make a page which pulls data from a table but only pulls the data for the certain user you are viewing by using the id as a filter

I am having trouble getting this to work

My routes file

Route::get('/view/profile/{id}', '[email protected]');

My [email protected]

        $users = User::all();
        $validations = Validations::all();
        $availability = Availability::all();
        $profile = User::where('id', $id)->firstOrFail();

        
        return view('profile', compact('validations', 'users', 'availability'));

My profile.blade.php file

<div class="row wrapper border-bottom white-bg page-heading">
    <div class="col-sm-4">
        <h2>View Profile - {{ $users->name_first }} {{ $users->name_last }}</h2>
        <ol class="breadcrumb">
            <li>
                <a href="{{ url('dashboard')}}">Users</a>
            </li>
            <li class="active">            
                <strong>{{ Users->name_first }} {{ $users->name_last }}</strong>
            </li>
        </ol>
    </div>
</div>

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