title: How to send data/variable from one method to another in the same controller in laravel 5?
body: <p>I have 2 functions/methods in the same controller in Laravel like this..</p>
  
  <pre><code>&lt;?php namespace App\Http\Controllers;
  
  use App\Http\Requests;
  //use App\Http\Requests\CreatRole;
  use App\Http\Controllers\Controller;
  use Input;
  use Redirect;
  
  use Illuminate\Http\Request;
  use App\UserRole;
  
  class UserController extends Controller {
  
      /**
       * Remove the specified resource from storage.
       *
       * @param  int  $id
       * @return Response
       */
      public function role()
      {
  
          return view('user.role');
      }
  
      /**
       * Remove the specified resource from storage.
       *
       * @param  int  $id
       * @return Response
       */
      public function roleProcess(Requests\CreatRole $request)
      {
              $input = Input::all();
              $role = new UserRole;
              $role-&gt;role_name = Input::get('role-name');
              $role-&gt;role_number = Input::get('role-number');
              $role-&gt;save();
  
              //redirect to add page;
              return Redirect::to('/home/role/add')-&gt;with('message','Role is added');
  
      }
  
  
  }
  </code></pre>
  
  <p>And My routes.php have route as</p>
  
  <pre><code>Route::get('/home/role/add','UserController@role');
  </code></pre>
  
  <p>What I am trying to do is adding  and listing the role can be done  from same view i.e on the same web page. I want to show the success message when the role is added. I think to do this we have to passes the success message from roleProcess to role but I don't know how to pass the variables or data from one method to another in laravel. </p>