Skip to content

Commit

Permalink
remove registration from config / add create user command
Browse files Browse the repository at this point in the history
  • Loading branch information
3x1io committed Apr 24, 2024
1 parent 1269feb commit bd1cb2f
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 2 deletions.
2 changes: 1 addition & 1 deletion publish/config/fortify.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
*/

'features' => [
Features::registration(),
// Features::registration(),
Features::resetPasswords(),
Features::emailVerification(),
Features::updateProfileInformation(),
Expand Down
56 changes: 56 additions & 0 deletions src/Console/TomatoAdminUser.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php

namespace TomatoPHP\TomatoAdmin\Console;

use App\Models\User;
use Illuminate\Console\Command;
use TomatoPHP\ConsoleHelpers\Traits\HandleFiles;
use TomatoPHP\ConsoleHelpers\Traits\RunCommand;
use function Laravel\Prompts\confirm;
use function Laravel\Prompts\password;
use function Laravel\Prompts\text;

class TomatoAdminUser extends Command
{
use RunCommand;
use HandleFiles;

/**
* The name and signature of the console command.
*
* @var string
*/
protected $name = 'tomato:user';

/**
* The console command description.
*
* @var string
*/
protected $description = 'create a new user for dashboard access';

/**
* @return void
*/
public function handle(): void
{
$name = text('What is your name?', required: true);
$email = text('What is your email?', required: true);
$password = password('What is your password?', required: true);

\Laravel\Prompts\info('Creating user...');

User::query()->createOrFirst([
'name' => $name,
'email' => $email,
'password' => bcrypt($password),
]);


\Laravel\Prompts\info('🍅 Thanks for using Tomato Plugins & TomatoPHP framework');
\Laravel\Prompts\info('💼 Join support server on discord https://discord.gg/VZc8nBJ3ZU');
\Laravel\Prompts\info('📄 You can check docs here https://docs.tomatophp.com');
\Laravel\Prompts\info('⭐ please gave us a start on any repo if you like it https://github.com/tomatophp');
\Laravel\Prompts\info('🤝 sponser us here https://github.com/sponsors/3x1io');
}
}
4 changes: 3 additions & 1 deletion src/TomatoAdminServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
use Illuminate\Support\Facades\Config;
use Illuminate\Support\ServiceProvider;
use Laravel\Jetstream\Jetstream;
use TomatoPHP\TomatoAdmin\Console\TomatoAdminUser;
use TomatoPHP\TomatoAdmin\Views\MarkdownEditor;
use TomatoPHP\TomatoAdmin\Views\MarkdownViewer;
use ProtoneMedia\Splade\Http\SpladeMiddleware;
Expand Down Expand Up @@ -112,7 +113,8 @@ public function register(): void

$this->commands([
TomatoAdminInstall::class,
TomatoAdminUpgrade::class
TomatoAdminUpgrade::class,
TomatoAdminUser::class
]);

$this->app->bind('tomato-menu',function(){
Expand Down

0 comments on commit bd1cb2f

Please sign in to comment.