title: how to send data in view from laravel controller in the body not in url after getting callback from google socialite?
body: <pre><code>Login Controller :
  &lt;?php
  
  namespace App\Http\Controllers\Auth;
  
  use Illuminate\Support\Facades\Redirect;
  
  
  use App\Http\Controllers\Controller;
  use Illuminate\Support\Facades\Route;
  use App\Providers\RouteServiceProvider;
  use Illuminate\Foundation\Auth\AuthenticatesUsers;
  
  use Laravel\Socialite\Facades\Socialite;
  use App\Models\User;
  
  class LoginController extends Controller
  {
     
  
      use AuthenticatesUsers;
  
      /**
       * Where to redirect users after login.
       *
       * @var string
       */
      //protected $redirectTo = '/home';
  
      /**
       * Create a new controller instance.
       *
       * @return void
       */
  
      public function redirectToProvider()
      {
          return Socialite::driver('google')-&gt;redirect();
      }
  
      /**
       * Obtain the user information from GitHub.
       *
       * @return \Illuminate\Http\Response
       */
      public function handleProviderCallback()
      {
          $user = Socialite::driver('google')-&gt;stateless()-&gt;user();
  
          $user_status = User::whereEmail($user-&gt;getEmail())-&gt;first();
  
          if ($user_status) {
              auth()-&gt;login($user_status, true);
  
              return Redirect::route('home', ['role' =&gt; $user_status-&gt;Role]);
          } else {
              return redirect('login');
          }
      }
      public function __construct()
      {
          $this-&gt;middleware('guest')-&gt;except('logout');
      }
  }
  
  In home.blade.php :
  @extends('layouts.admin')
  
  @section('content')
  &lt;!-- Content Header (Page header) --&gt;
  &lt;div class=&quot;content-header&quot;&gt;
      &lt;div class=&quot;container-fluid&quot;&gt;
          &lt;div class=&quot;row mb-2&quot;&gt;
              &lt;div class=&quot;col-sm-6&quot;&gt;
                  &lt;h1 class=&quot;m-0 text-dark&quot;&gt;Dashboard&lt;/h1&gt;
              &lt;/div&gt;&lt;!-- /.col --&gt;
              &lt;div class=&quot;col-sm-6&quot;&gt;
                  &lt;ol class=&quot;breadcrumb float-sm-right&quot;&gt;
                      &lt;li class=&quot;breadcrumb-item&quot;&gt;&lt;a href=&quot;{{route('home')}}&quot;&gt;Home&lt;/a&gt;&lt;/li&gt;
  
                  &lt;/ol&gt;
              &lt;/div&gt;&lt;!-- /.col --&gt;
          &lt;/div&gt;&lt;!-- /.row --&gt;
      &lt;/div&gt;&lt;!-- /.container-fluid --&gt;
  &lt;/div&gt;
  &lt;!-- /.content-header --&gt;
  
  &lt;!-- Main content --&gt;
  &lt;section class=&quot;content&quot;&gt;
      &lt;div class=&quot;container-fluid&quot;&gt;
          &lt;!-- Small boxes (Stat box) --&gt;
  
          &lt;!-- /.row --&gt;
          &lt;!-- Main row --&gt;
          {{$role}}
          &lt;!-- /.row (main row) --&gt;
      &lt;/div&gt;&lt;!-- /.container-fluid --&gt;
  &lt;/section&gt;
  &lt;!-- /.content --&gt;
  @endsection
  
  web.php :
  
  Route::get('/', function () {
      return view('welcome');
  });
  
  Auth::routes();
  
  Route::get('/home/{role?}', [App\Http\Controllers\HomeController::class, 'index'])-&gt;name('home');
  
  Route::get('login/google', [LoginController::class, 'redirectToProvider']);
  Route::get('login/google/callback', [LoginController::class, 'handleProviderCallback']);
  </code></pre>
  <p>Question :<br />
  So my query is that i want to redirect to page with user's role data to home page.
  so when i write {{$role}} in home page it says that $role is undefined. my main motive is to change content page based on the user but i could not get the data in view page. also it does send data once in URL but i forgot that code(Beginner) so kindly advice me what to do.</p>