In my existing laravel project, I handle logins with a username.
I\'ve already replaced email with username on app\\Nova\\User.php
please help me how can I d
After study about this issue, I've solved my own question. here's the way I go.
app\Provider\NovaServiceProvider.php
use Illuminate\Support\Facades\Route;
//.....
protected function routes()
{
$this->myLoginRoutes();
Nova::routes()
// ->withAuthenticationRoutes()
->withPasswordResetRoutes()
->register();
}
/** ADD YOUR OWN LOGIN ROUTE */
public function myLoginRoutes($middleware = ['web'])
{
Route::namespace('App\Nova\Http\Controllers\Auth')
->middleware($middleware)
->as('nova.')
->prefix(Nova::path())
->group(function () {
Route::get('/login', 'LoginController@showLoginForm');
Route::post('/login', 'LoginController@login')->name('login');
});
}
Copy
nova\src\resources\views\*
to
app\resources\views\vendor\nova\*
and you can free to modify what you want in view.
Copy
nova\src\Http\Controllers\LoginController.php
to
app\Nova\Http\Controllers\Auth\LoginController.php
and modify namespace to App\Nova\Http\Controllers\Auth;
app\Nova\Http\Controllers\Auth\LoginController.php
// ADD THIS METHOD TO OVERRIDE
public function username()
{
return 'username';
}
assume you've changed email to username in users migration