Aryabhima A. Rahman
Aryabhima A. Rahman

Reputation: 405

Laravel 9 require laravel/ui to use Auth::routes

I am upgrading my project to Laravel 9. However, when I tried to run php artisan, I got an error message.

In Auth.php line 60: To use the Auth::routes() method, please install the laravel/ui package.

So I install the package, but I still get the same error message. What might be the problem, and how can I fix it?

Upvotes: 8

Views: 41168

Answers (5)

saeed Ahmadluei
saeed Ahmadluei

Reputation: 1

Auth::routes() just insert authentication route to web.php, you could insert authentication route to web.php manually and do not use Auth::routes(), however for using Auth::routes() you must install laravel/ui package.

Upvotes: 0

you can just run composer update it worked for me

Upvotes: 0

Mohit Nandpal
Mohit Nandpal

Reputation: 143

It indicates that you need to install the Laravel/ui package in order to use the Auth::routes() method.

To resolve this issue, you can follow these steps:

Step 1: Install the laravel/ui package using Composer:

composer require laravel/ui

Step 2: Generate authentication scaffolding for it.

For Bootstrap-based scaffolding:

php artisan ui bootstrap --auth

For Vue.js-based scaffolding:

php artisan ui vue --auth

For React-based scaffolding:

php artisan ui react --auth

Step 3: Use Auth::routes() in routes/web.php

// routes/web.php
use Illuminate\Support\Facades\Route;

// ...

Auth::routes();

// ...

Upvotes: 2

Splatbang
Splatbang

Reputation: 776

Had the same issue but had it working locally but not on the web host. In case you are uploading to a remote server and you can't run composer/artisan make sure to also upload the files in bootstrap/cache (packages.php and services.php)

Upvotes: 3

Nawaf Khalifah
Nawaf Khalifah

Reputation: 786

Step 1: (Install Laravel UI)

composer require laravel/ui

Step 2: (Generate Auth UI)

php artisan ui bootstrap --auth

Also please read the documentation: https://github.com/laravel/ui/blob/3.x/README.md

Upvotes: 13

Related Questions