title: View data form id column in Laravel 5.2
body: <p>I have two table in database classrooms and status. classroom fields  are <code>id</code>,<code>subject</code>, <code>class_code</code>, <code>user_id</code>. I make a link for every class. now i want to show data in my class view page for every class. If my class link <code>class?class_id=47</code> then its must be show only <code>class?class_id=47</code> data and if <code>class?class_id=55</code> its must be show <code>class?class_id=55</code> data but in my <code>class?class_id=55</code> class its shows class?class_id=47 class data.</p>
  
  <p>My controller:</p>
  
  <pre><code>public function getclass(Request $request)
  {
      $id = $request-&gt;get('class_id'); if(Input::has('status-text'))
      {
          $text=e(Input::get('status-text'));
          $rules = [
          'status_text'=&gt;'required|string',
          ];
          $validator = Validator::make($request-&gt;all(), $rules);
          if(Input::hasFile('status_image_upload'))
          {
              $rules['status_image_upload'] = 'image';
              $validator = Validator::make($request-&gt;all(), $rules);
              if($validator-&gt;fails())
              {
                  $image = $request-&gt;file('status_image_upload');
                  $imageName = str_random(8).'_'.$image-&gt;getClientOriginalName();
                  $image-&gt;move('status_images', $imageName);
                  $userStatus = new Status();
                  $userStatus -&gt; class_id = $id;
                  $userStatus -&gt; status_text = $text;
                  $userStatus -&gt; image_url = $imageName;
                  $userStatus -&gt; type = 1;
                  $userStatus -&gt; users_id = Auth::user()-&gt;id;
                  $userStatus -&gt; save();
                  Flash::success('Your status has been posted');
                  return redirect(route('class',['class_id'=&gt;$id]));
              }
          }
          else if ($validator-&gt;fails())
          {
              $userStatus = new Status();
              $userStatus -&gt; class_id = $id;
              $userStatus -&gt; status_text = $text;
              $userStatus -&gt; video_url = $request['video_url'];
              $userStatus -&gt; type = 2;
              $userStatus -&gt; users_id = Auth::user()-&gt;id;
              $userStatus -&gt; save();
              Flash::success('Your status has been posted');
              return redirect(route('class',['class_id'=&gt;$id]));
          }
  }return view('class',[
  'posts'=&gt;status::orderBy('id','DESC')-&gt;get()
  ])-&gt;with('class_id',$request-&gt;get('class_id'))
  -&gt;with('classroom',classroomModel::find($id)-&gt;first());}
  </code></pre>
  
  <p><strong>My view</strong></p>
  
  <pre><code>&lt;li&gt;Subject--&gt;{{$classroom-&gt;subject_name}}&lt;/li&gt;
  &lt;li&gt;Section--&gt;{{$classroom-&gt;section}}&lt;/li&gt;
  </code></pre>
  
  <p>What should to do for that?</p>