admin管理员组

文章数量:1122832

On laravel / livewire / jetstream site I try to change name of field by which user login into the site and I changed in config/fortify.php:

'username' => 'login', // 'email',

and checking docs for 5 branch at .html#customizing-user-authentication I read :

The authenticateUsing method accepts a closure that receives the incoming HTTP request. The closure is responsible for validating the login credentials attached to the request and returning the associated user instance. If the credentials are invalid or no user can be found, null or false should be returned by the closure. Typically, this method should be called from the boot method of your JetstreamServiceProvider:

php use App\Models\User; use Illuminate\Http\Request; use Illuminate\Support\Facades\Hash; use Laravel\Fortify\Fortify;

/** * Bootstrap any application services. */ public function boot(): void { // ...

Fortify::authenticateUsing(function (Request $request) {
    $user = User::where('email', $request->email)->first();

    if ($user &&
        Hash::check($request->password, $user->password)) {
        return $user;
    }
}); }

But opening file app/Providers/JetstreamServiceProvider.php it has different content :

<?php

namespace App\Providers;

use App\Actions\Jetstream\DeleteUser;
use Illuminate\Support\ServiceProvider;
use Laravel\Jetstream\Jetstream;

class JetstreamServiceProvider extends ServiceProvider
{
    /**
     * Register any application services.
     */
    public function register(): void
    {
        //
    }

    /**
     * Bootstrap any application services.
     */
    public function boot(): void
    {
        $this->configurePermissions();

        Jetstream::deleteUsersUsing(DeleteUser::class);
    }

    /**
     * Configure the permissions that are available within the application.
     */
    protected function configurePermissions(): void
    {
        Jetstream::defaultApiTokenPermissions(['read']);

        Jetstream::permissions([
            'create',
            'read',
            'update',
            'delete',
        ]);
    }
}

Searching in my project I did not find any substring like Fortify::authenticateUsing ...

Very frustrated!

In which way I have to edit this file ?

"laravel/framework": "^11.31",
"laravel/jetstream": "^5.3",
"livewire/livewire": "^3.0",

Thanks in advance!

本文标签: