title: How to return an array after calling a function in a laravel controller
body: <p>I´m using laravel. My UserController call a public function (validateToken) which is placed on the top of the controller. I call my function from an another public function, but this doesn´t return anything.
  this is my code:</p>
  
  <pre><code>use App\Comment;
  use App\User;
  use Illuminate\Http\Request;
  use Illuminate\Support\Facades\DB;
  use Illuminate\Support\Facades\Input;
  use Illuminate\Support\Facades\Validator;
  
  class UserController extends Controller
  {
      public function validateToken($token)
      {
          $user = User::where('token', $token)-&gt;first();
  
          if(!isset($user))
          {
              return array(
                  'message' =&gt; "These credentials do not match our records.",
                  'success' =&gt; false
                  };
          }
      }
  
      public function register(Request $request)
      {
          $input = Input::all();
  
          $this-&gt;validateToken($input['token']);
  
          return array(
              'message' =&gt; 'Your account has been created successfully and is ready to use', 
              'token'   =&gt; $input['token'], 
              'success' =&gt; true
             );
      }
  </code></pre>
  
  <p>It works if the validateToken code is placing inside the register function</p>