title: Call to a member function check_if_exist() on null in laravel
body: <p>im doing save cookie but have a problem . Here is my helper</p>
  
  <pre><code>public function check_if_exist($user){
  
      $isExisted = User::where('email', $request-&gt;get('email'))-&gt;first();
  
      if(!$isExisted) {
          $user = new User();
          $user = $user-&gt;isExisted($request);
          $user-&gt;save();
          Cookie::queue($user);
      }
      Cookie::queue($user);
  }
  </code></pre>
  
  <p>and here is my controller , i </p>
  
  <pre><code>public function store(SignRequest $request, WiuCookie $wcookie, CheckUser $check)
  {
      $check = ActionUsers::where('petition_id', $request-&gt;get('petition_id'))-&gt;where('email', $request-&gt;get('email'))-&gt;first();
  
      if($check) {
          return back()-&gt;with('fail','You fail');
      }
  
      $sign = new ActionUsers();
      $sign = $sign-&gt;init($request);
  
      if( $sign-&gt;save() ){
  
          $wcookie-&gt;setById($sign-&gt;petition_id);
          $check-&gt;check_if_exist($sign);
          return redirect('/thanks/signed/'.$sign-&gt;petition-&gt;slug);
  
      }else{
          return redirect()-&gt;back();
      }
  }
  </code></pre>
  
  <p>and error is </p>
  
  <blockquote>
    <p>Call to a member function check_if_exist() on null.</p>
  </blockquote>
  
  <p>I dont know i called variable right or not. i'm use enough params but it's not working Anyone can solve that. Thanks</p>