传递给照亮\身份验证\雄辩用户提供的参数 1:

传递给照明\身份验证\雄辩用户提供的参数 1 提供者::验证证书() 必须是照明\合同\身份验证\可验证的实例,应用程序\模型\用户给定的实例,在 D:\xampp\htdocs\后端\电子商务\供应商\laravel\框架\src\照亮\身份验证\SessionGuard.php第 384 行----我有此问题,请帮助我我的模型页面



namespace App;


use Illuminate\Contracts\Auth\MustVerifyEmail;

use Illuminate\Foundation\Auth\User as Authenticatable;

use Illuminate\Notifications\Notifiable;


class User extends Authenticatable

{

    use Notifiable;


    /**

     * The attributes that are mass assignable.

     *

     * @var array

     */

    protected $fillable = [

        'name', 'email', 'password',

    ];


    /**

     * The attributes that should be hidden for arrays.

     *

     * @var array

     */

    protected $hidden = [

        'password', 'remember_token',

    ];


    /**

     * The attributes that should be cast to native types.

     *

     * @var array

     */

    protected $casts = [

        'email_verified_at' => 'datetime',

    ];

}

我的控制器



namespace App\Http\Controllers;


use App\Mail\UserRegisterMail;

use App\Models\User;

use Illuminate\Http\Request;

use Illuminate\Support\Facades\Auth;

use Illuminate\Support\Facades\Hash;

use Illuminate\Support\Str;

use Illuminate\Support\Facades\Mail;



class UserController extends Controller

{

    public function login(){

        return view('user.login');

    }


    public function register(){

        return view('user.register');

    }


    public function registerPost(Request $request){

        $request->validate([

            'ad' => 'required|max:60',

            'email' => 'required|email',

            'şifrə' => 'required|confirmed',

        ]);

        $request->flash();

        $user = User::create([

            'name' => $request->ad,

            'email' => $request->email,

            'password' => Hash::make($request->şifrə),

            'activation_code' => Str::random(60),

            'active' => 0

        ]);

        Mail::to($request->email)->send(new UserRegisterMail($user));

        // auth()->login($user,true);

        return redirect()->route('home');

    }



智慧大石
浏览 134回答 2
2回答

沧海一幻觉

更改将模型扩展到可验证性。在您的模型中

catspeake

为您的模型添加和更改以下行:User加:use Illuminate\Foundation\Auth\User as Authenticatable;改变:class User extends Model自class User extends Authenticatable
打开App,查看更多内容
随时随地看视频慕课网APP