Using element queries in general.php config file
Add this at the top of config/general.php file:

use craft\elements\Entry;


And change your loginPath value to:

'loginPath' =&gt; function() {
   return Entry::find()-&gt;section('login')-&gt;one()-&gt;url ?? null;
},