本文介紹了在 Laravel 中手動注冊用戶的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
是否可以手動注冊用戶(使用 artisan?)而不是通過身份驗證注冊頁面?
Is it possible to manually register a user (with artisan?) rather than via the auth registration page?
我只需要幾個用戶帳戶,想知道是否有辦法創建這些帳戶而無需設置注冊控制器和視圖.
I only need a handful of user accounts and wondered if there's a way to create these without having to set up the registration controllers and views.
推薦答案
我認為您想一次性完成此操作,因此不需要創建 Artisan 命令等花哨的東西.我建議簡單地使用 php artisan tinker
(很棒的工具!)并為每個用戶添加以下命令:
I think you want to do this once-off, so there is no need for something fancy like creating an Artisan command etc. I would suggest to simply use php artisan tinker
(great tool!) and add the following commands per user:
$user = new AppUser();
$user->password = Hash::make('the-password-of-choice');
$user->email = 'the-email@example.com';
$user->name = 'My Name';
$user->save();
這篇關于在 Laravel 中手動注冊用戶的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!