diff --git a/bin/sync b/bin/sync index 15401c1..150e319 100755 --- a/bin/sync +++ b/bin/sync @@ -85,6 +85,11 @@ transform([ line("return redirect()->intended(route('dashboard', absolute: false));", 2) => line('return redirect()->intended($this->redirectToAfterLoggedIn());', 2), ], static fn ($changes) => $files->replaceInFile(array_keys($changes), array_values($changes), "{$workingPath}/src/Http/Controllers/Auth/AuthenticatedSessionController.php")); +transform([ + line('function (User $user) use ($request) {', 3) => line('function ($user) use ($request) {', 3), + line('use Workbench\App\Models\User;') => '', +], static fn ($changes) => $files->replaceInFile(array_keys($changes), array_values($changes), "{$workingPath}/src/Http/Controllers/Auth/NewPasswordController.php")); + transform([ line("return redirect(route('dashboard', absolute: false));", 2) => line('return redirect($this->redirectToAfterLoggedIn());', 2), ], static fn ($changes) => $files->replaceInFile(array_keys($changes), array_values($changes), "{$workingPath}/src/Http/Controllers/Auth/RegisteredUserController.php")); diff --git a/src/AuthServiceProvider.php b/src/AuthServiceProvider.php index fb600cf..518ac0e 100644 --- a/src/AuthServiceProvider.php +++ b/src/AuthServiceProvider.php @@ -14,7 +14,9 @@ class AuthServiceProvider extends ServiceProvider */ public function boot(): void { - $this->loadRoutesFrom((string) realpath(join_paths(__DIR__, '..', 'routes', 'workbench-auth.php'))); + $this->booted(function () { + $this->loadRoutesFrom((string) realpath(join_paths(__DIR__, '..', 'routes', 'workbench-auth.php'))); + }); $this->loadViewsFrom((string) realpath(join_paths(__DIR__, '..', 'resources', 'views')), ''); diff --git a/src/Http/Controllers/Auth/NewPasswordController.php b/src/Http/Controllers/Auth/NewPasswordController.php index 4025bbf..5481781 100644 --- a/src/Http/Controllers/Auth/NewPasswordController.php +++ b/src/Http/Controllers/Auth/NewPasswordController.php @@ -11,7 +11,6 @@ use Illuminate\Validation\Rules; use Illuminate\View\View; use Orchestra\Workbench\Http\Controllers\Controller; -use Workbench\App\Models\User; class NewPasswordController extends Controller { @@ -41,7 +40,7 @@ public function store(Request $request): RedirectResponse // database. Otherwise we will parse the error and return the response. $status = Password::reset( $request->only('email', 'password', 'password_confirmation', 'token'), - function (User $user) use ($request) { + function ($user) use ($request) { $user->forceFill([ 'password' => Hash::make($request->password), 'remember_token' => Str::random(60), diff --git a/src/Workbench.php b/src/Workbench.php index c56ae3c..afd9524 100644 --- a/src/Workbench.php +++ b/src/Workbench.php @@ -39,6 +39,8 @@ public static function applicationPath(array|string $path = ''): string * * @no-named-arguments * + * @param array|string ...$path + * * @see \Orchestra\Workbench\Workbench::applicationPath() */ public static function laravelPath(array|string $path = ''): string diff --git a/src/WorkbenchServiceProvider.php b/src/WorkbenchServiceProvider.php index 688bac3..c0658d7 100644 --- a/src/WorkbenchServiceProvider.php +++ b/src/WorkbenchServiceProvider.php @@ -42,7 +42,9 @@ public function register(): void */ public function boot(): void { - $this->loadRoutesFrom((string) realpath(join_paths(__DIR__, '..', 'routes', 'workbench.php'))); + $this->booted(function () { + $this->loadRoutesFrom((string) realpath(join_paths(__DIR__, '..', 'routes', 'workbench.php'))); + }); $this->app->make(HttpKernel::class)->pushMiddleware(Http\Middleware\CatchDefaultRoute::class);