問題描述
是否可以手動(dòng)注冊用戶(使用 artisan?)而不是通過身份驗(yàn)證注冊頁面?
Is it possible to manually register a user (with artisan?) rather than via the auth registration page?
我只需要幾個(gè)用戶帳戶,想知道是否有辦法創(chuàng)建這些帳戶而無需設(shè)置注冊控制器和視圖.
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.
推薦答案
我認(rèn)為您想一次性完成此操作,因此不需要?jiǎng)?chuàng)建 Artisan 命令等花哨的東西.我建議簡單地使用 php artisan tinker
(很棒的工具!)并為每個(gè)用戶添加以下命令:
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();
這篇關(guān)于在 Laravel 中手動(dòng)注冊用戶的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!