title: Laravel : How to update data in one to one Eloquent relationship
body: <p>I have two tables:</p>
  
  <pre><code> 1. User.
   2. Post.
  </code></pre>
  
  <p>In post table i have saved the user information. So when I click on update, it should load the particular user data. It's get loaded but when i click on the save button to update save.It's showing the following Error.</p>
  
  <blockquote>
    <p>FatalErrorException in PostController.php line 78: Call to undefined
    function App\Http\Controllers\fill()</p>
  </blockquote>
  
  <p>I think i have problem with my postUpdate controller. But I couldn't find the problem.</p>
  
  <p>Here is my User model:</p>
  
  <pre><code>&lt;?php
  
  namespace App;
  
  use Illuminate\Foundation\Auth\User as Authenticatable;
  
  class User extends Authenticatable
  {
  
      protected $fillable = [
          'name', 'email', 'password',
      ];
  
  
      protected $hidden = [
          'password', 'remember_token',
      ];
  
       public function post()
      {
          return $this-&gt;hasOne('App\Post'); //Profile is your profile model
      }
  }
  </code></pre>
  
  <p>Here is my Post Model:</p>
  
  <pre><code>&lt;?php
  
  namespace App;
  
  use Illuminate\Database\Eloquent\Model;
  
  class Post extends Model
  {
        protected $fillable = [
      'first_name', 'middle_name', 'last_name','gender',                            'dob','nationality','nid','email','phone_no','about_me'
  ];
       public function user()
      {
         return $this-&gt;belongsTo('App\User'); //Profile is your profile model
      }
  }
  </code></pre>
  
  <p>And here is my post Controller:</p>
  
  <pre><code>&lt;?php
  
  namespace App\Http\Controllers;
  
  use Illuminate\Http\Request;
  use Illuminate\Http\Response;
  use App\Http\Requests;
  use App\Post;
  use App\User;
  use Illuminate\Support\Facades\Auth;
  use Illuminate\Support\Facades\Storage;
  use Illuminate\Support\Facades\File;
  
  class PostController extends Controller
  {
  
  
     public function getDashboard()
     {        
       $posts = Post::all();
            return view('dashboard',['posts'=&gt;$posts]);  
      }
  
  
    public function postCreate(Request $request){
      $this-&gt;validate($request,[
        'first_name'=&gt; 'required|max:120',
        'middle_name'=&gt; 'required|max:120',
        'last_name' =&gt; 'required|max:120',
        'gender'=&gt; 'required',
        'dob'=&gt;'required',
        'nationality'=&gt;'required',
        'nid'=&gt;'required',
        'email' =&gt; 'required|email|unique:users',
        'phone_no'=&gt;'required',
        'about_me'=&gt;'required',
          ]);
  
      $post = new Post();
          $post-&gt;first_name = $request['first_name'];
          $post-&gt;middle_name = $request['middle_name'];
          $post-&gt;last_name = $request['last_name'];
          $post-&gt;gender = $request['gender'];
          $post-&gt;dob = $request['dob'];
          $post-&gt;nationality = $request['nationality'];
          $post-&gt;nid = $request['nid'];
          $post-&gt;email = $request['email'];
          $post-&gt;phone_no = $request['phone_no'];
          $post-&gt;about_me = $request['about_me'];        
          $message='There was an Error';
          if( $request-&gt;user()-&gt;post()-&gt;save($post)){
            $message = "Profile Created successfully";
          }
          return redirect()-&gt;route('dashboard')-&gt;with(['message' =&gt; $message]);
  
    }
  
  
      public function postUpdate(Request $request)
      {
            $this-&gt;validate($request,[
              'first_name'=&gt; 'required|max:120',
              'middle_name'=&gt; 'required|max:120',
              'last_name' =&gt; 'required|max:120',
              'gender'=&gt; 'required',
              'dob'=&gt;'required',
              'nationality'=&gt;'required',
              'nid'=&gt;'required',
              'email' =&gt; 'required|email|unique:users',
              'phone_no'=&gt;'required',
              'about_me'=&gt;'required',
              ]);
  
  
          $request-&gt;user()-&gt;post()-&gt;update(fill($request-&gt;all())) ;  
  
          return redirect()-&gt;route('dashboard');
         }
  
  
  
  }
  </code></pre>