title: Can I use return to a public function in controller in Laravel 8
body: <p>I got an error which is undefined function.</p>
  <p>I tried to use a public function in <code>return</code>:</p>
  <pre><code>public function CreateForm()   //This the function that I want to use back
  {
   
      $names2 = DB::table('pendaftaran')
      -&gt;where('isActive',0)
      -&gt;orderBy('id','desc')
      -&gt;get();
  
      return view('contact')-&gt;with($variables);
  }
  </code></pre>
  <p>So this a function I want to return to a function</p>
  <pre><code>public function AddUserSubmit(Request $request)
  {
      $this-&gt;validate($request,
      [
          'Nama'=&gt;'required',
          'NoKP'=&gt;'required',
         
      ]);
      Pendaftaran::create($request-&gt;all());
  
  
      return CreateForm();   //Can I return to a public function ?
  }
  </code></pre>