1 year ago

Pulling data from table based on ID

Posted 1 year 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">
                <a href="{{ url('dashboard')}}">Users</a>
            <li class="active">            
                <strong>{{ Users->name_first }} {{ $users->name_last }}</strong>

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