title: Use Laravel Livewire with Laravel Fortify for Login
body: <p>I'm wanting to use Laravel Fortify and Livewire to create a very simple login form. I do not want to use Jetstream as it has more features that I do not need vs features I do need.</p>
  <p>I'm using livewire throughout my app, and would like to use it for my login page to provide real time instant validation.</p>
  <p>The problem I am encountering is I am unable to submit the form with values if I'm using <code>wire:model</code> on inputs.</p>
  <p>I also can not use <code>auth()-&gt;attempt()</code> because it is being hijacked by Fortify.(At least, I think it is. All know is when I use it, it returns <code>false</code>)</p>
  <p>How can I use livewire with fortify? I need to send the data from the livewire component to <code>POST /login</code>.</p>
  <p>Here is my current set up:</p>
  <p><code>FortifyServiceProvider.php</code></p>
  <pre><code>public function boot()
      {
          Fortify::createUsersUsing(CreateNewUser::class);
          Fortify::updateUserProfileInformationUsing(UpdateUserProfileInformation::class);
          Fortify::updateUserPasswordsUsing(UpdateUserPassword::class);
          Fortify::resetUserPasswordsUsing(ResetUserPassword::class);
  
          // Custom Fortify Views =============================
  
          // Login Page
          Fortify::loginView(function () {
              return view('auth.login');
          });
     }
  </code></pre>
  <p>My <code>auth/login.blade.php</code> (simply calls the livewire components with the proper layout template)</p>
  <pre><code>&lt;x-layouts.auth&gt;
      @livewire('auth.login')
  &lt;/x-layouts.auth&gt;
  </code></pre>
  <p>The livewire component <code>livewire/auth/login.blade.php</code>:</p>
  <pre><code>&lt;form wire:submit.prevent=&quot;login&quot; action=&quot;#&quot; method=&quot;POST&quot;&gt;
      &lt;div&gt;
          &lt;label for=&quot;email&quot;&gt;Email address&lt;/label&gt;
          &lt;input wire:model=&quot;email&quot; id=&quot;email&quot; type=&quot;email&quot; required autofocus&gt;
          @error('email'){{ $message }}@enderror
      &lt;/div&gt;
  
      &lt;div&gt;
          &lt;label for=&quot;password&quot;&gt;Password&lt;/label&gt;
          &lt;input wire:model.lazy=&quot;password&quot; id=&quot;password&quot; type=&quot;password&quot; required&gt;
          @error('password'){{ $message }}@enderror
      &lt;/div&gt;
  
      &lt;div&gt;
          &lt;input wire:model.lazy=&quot;remember&quot; id=&quot;remember_me&quot; type=&quot;checkbox&quot;&gt;
          &lt;label for=&quot;remember_me&quot;&gt;Remember me&lt;/label&gt;
  
          &lt;a href=&quot;#&quot;&gt;Forgot your password?&lt;/a&gt;
      &lt;/div&gt;
  
      &lt;div&gt;
          &lt;button type=&quot;submit&quot;&gt;Sign in&lt;/button&gt;
      &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  <p>and my <code>Http/Livewire/Auth/Login.php</code> file for the livewire component:</p>
  <pre><code>class Login extends Component
  {
      public $email = '';
      public $password = '';
      public $remember = false;
  
      protected $rules = [
          'email' =&gt; 'required|email|exists:users,email',
          'password' =&gt; 'required',
      ];
  
      /**
       * Shows Real time validation for email field
       */
      public function updatedEmail() {
          $this-&gt;validate(['email' =&gt; 'email|exists:users,email']);
      }
  
      /**
       * Logs user in when form is submitted
       * @return \Illuminate\Http\RedirectResponse|\Illuminate\Support\MessageBag
       */
      public function login()
      {
          // ******* Need to submit the form to Fortify here?? ******
      }
  
      /**
       * Renders the view
       * @return mixed
       */
      public function render()
      {
          return view('livewire.auth.login')
              -&gt;layout('layouts.auth');
      }
  }
  </code></pre>