title: Facing Errors in Laravel
body: <p>I am creating admin panel. When user update their profile its <code>userid</code> read by update controller method using route name <code>update</code>. The update controller method returns a view <code>updatedata</code> along with an array. I am using ORM DATABASE</p>
  
  <p><strong>Controller</strong></p>
  
  <pre><code>public function update($id)
  {
     $records = Register::find($id);
     return view('updatedata',['records' =&gt; $records]);  
  }
  </code></pre>
  
  <p><strong>Template</strong></p>
  
  <pre><code>@extends('layout/master')
  @section('content')
  &lt;h1 align="center"&gt;
  
  @foreach($records as $records)
  {!!  Form::open(['route'=&gt;'f.update'])   !!}
  &lt;table border="2" align="center"&gt;
    &lt;tr&gt;
       &lt;td&gt;{!! Form::label('name','Name') !!}&lt;/td&gt;
         &lt;td&gt;{!!  Form::text('name',$records-&gt;name) !!}&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
         &lt;td&gt;{!!Form::label('phone','Phone')!!}&lt;/td&gt;
         &lt;td&gt;{!! Form::text('phone',$records-&gt;phone) !!}&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
         &lt;td&gt;{!! Form::label('email','E-mail') !!}&lt;/td&gt;
         &lt;td&gt;{!! Form::email('email',$records-&gt;name) !!}&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
         &lt;td&gt;{!! Form::label('course','Course') !!}&lt;/td&gt;
         &lt;td&gt;{!! Form::select('course',['MCA'=&gt;'MCA','BTECH'=&gt;'BTECH','BCA'=&gt;'BCA'],$records-&gt;course)                                               !!}&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
         &lt;td&gt;{!! Form::label('address','Address') !!}&lt;/td&gt;
         &lt;td&gt;{!! Form::textarea('address', $records-&gt;address, ['size' =&gt; '30x3']) !!}&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td colspan="2"&gt;
          {!! Form::hidden('id',$records-&gt;id) !!}
        &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
         &lt;td colspan="2" align="center"&gt;{!!  Form::submit() !!}&lt;/td&gt;
      &lt;/tr&gt;
  
  &lt;/table&gt;
  
  {!!  Form::close()                                    !!}
  @endforeach 
  &lt;/h1&gt;
  @endsection
  </code></pre>
  
  <p><strong>Error</strong></p>
  
  <blockquote>
    <p>2/2<br>
    ErrorException in 4de1c6468785010f583b37a90fa7bed16c4e92a7.php line 10:<br>
    Trying to get property of non-object (View: C:\xampp\htdocs\laravel\resources\views\updatedata.blade.php)</p>
  </blockquote>
  
  <p>Please help.</p>