configurePermissions(); Jetstream::deleteUsersUsing( DeleteUser::class); Fortify::authenticateUsing( function (Request $request) { $validated = $request->validate( [ 'school_no' => 'required|required|regex:/[a-z A-z]{2}\d{6}/', 'password' => 'required', ] ); // lowercase the school_no $validated['school_no'] = strtolower( $validated['school_no'] ); $user = User::where( 'school_no', $validated['school_no'] ) ->first(); // dd($user); if ( $user && Hash::check( $request->password, $user->password ) ) { if ( $user->valid_date < now() ) { throw ValidationException::withMessages( [ '' => [ "您的帳號已過期,有問題請向課程經理詢問" ], ] ); } return $user; } } ); // Fortify::resetUserPasswordsUsing( ); } /** * Configure the permissions that are available within the application. */ protected function configurePermissions(): void { Jetstream::defaultApiTokenPermissions( [ 'read' ] ); Jetstream::permissions( [ 'create', 'read', 'update', 'delete', ] ); } }