php - What's the cause Undefined property: stdClass? -


i don't know error cause. didn't change in codes. when go search view. returns me undefined property error. error cause when tried foreach columns in table data. solve error not once. because cannot find $id of selected options. time can't fix it.

error:

undefined property: stdclass::$id (view: c:\users\johnfrancis\laravelfrancis\resources\views\document\show.blade.php)

view

show.blade.php - view list values in tables.

@section ('content')  <div class = "col-md-12">      <table class = "table">          <thead>             <tr>                 <th>title</th>                 <th>content</th>                 <th>category</th>                 <th>sender</th>                 <th>date received</th>                 <th>action</th>             </tr>         </thead>          <tbody>             @foreach ($documentlists $list)                 <tr class = "info">                     <td>{{ $list->title }}</td>                     <td>{{ strip_tags(substr($list->content, 0, 50)) }} {{  strlen($list->content) > 50 ? "..." : '' }}</td>                     <td>{{ $list->category_type }}</td>                     <td>{{ $list->username }}</td>                     <td>{{ date('m j, y', strtotime($list->datereceived)) }}</td>                     <td>                         <a href = "{{ route ('document.read', $list->id) }}"><button type = "submit" class = "btn btn-info">read</button></a>                     </td>                 </tr>             @endforeach         </tbody>      </table>  </div>  @endsection 

read.blade.php - redirect current view selected.

<!--document controller--> <div class = "col-md-6">  <form class = "vertical">      <div class = "form-group">          <textarea id = "content">{{ $documentlists->content }}</textarea>      </div>      <div class = "form-group">          <button type = "submit" class = "btn btn-success">approve</button>      </div>  </form>  </div> 

controller

//show public function showdocuments() {      $documentlists = db::table('document_user')->select('documents.title', 'documents.content', 'categories.category_type', 'users.username', 'document_user.datereceived')         //table name     //pk                  //fk         ->join('users', 'users.id', '=', 'document_user.sender_id')         ->join('documents', 'documents.id', '=', 'document_user.document_id')         ->join('categories', 'categories.id', '=', 'documents.category_id')         ->where('sender_id', '!=', auth::id())         ->where('user_id', '!=', auth::id())->get();      //view     return view ('document.show')->with('documentlists', $documentlists); }  //read public function readdocuments($id) {     //find document in database , save var.     $documentlists = document::find($id);      return view ('document.read')->with('documentlists', $documentlists); } 

routes

route::get('/show', [     'uses' => '\app\http\controllers\documentcontroller@showdocuments',     'as' => 'document.show',     'middleware' => 'auth', ]);  route::get('/receive/documents/{id}', [     'uses' => '\app\http\controllers\documentcontroller@readdocuments',     'as' => 'document.read',     'middleware' => 'auth', ]); 

in below not selecting id

$documentlists = db::table('document_user')->select('documents.title', 'documents.  

but calling in blade {{ route ('document.read', $list->id) }}


Comments