Skip to content

Instantly share code, notes, and snippets.

@MubinSayed
Forked from meigwilym/console.php
Created April 1, 2021 11:23
Show Gist options
  • Save MubinSayed/4c1a3800a5ded533db13097c1d80e686 to your computer and use it in GitHub Desktop.
Save MubinSayed/4c1a3800a5ded533db13097c1d80e686 to your computer and use it in GitHub Desktop.

Revisions

  1. @meigwilym meigwilym revised this gist Dec 6, 2017. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions console.php
    Original file line number Diff line number Diff line change
    @@ -6,6 +6,7 @@
    $name = $this->ask('Name?');
    $email = $this->ask('Email?');
    $pwd = $this->ask('Password?');
    // $pwd = $this->secret('Password?'); // or use secret() to hide the password being inputted
    \DB::table('users')->insert([
    'name' => $name,
    'email' => $email,
  2. @meigwilym meigwilym created this gist Dec 5, 2017.
    17 changes: 17 additions & 0 deletions console.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    <?php
    // routes/console.php

    // quickly create an user via the command line
    Artisan::command('user:create', function () {
    $name = $this->ask('Name?');
    $email = $this->ask('Email?');
    $pwd = $this->ask('Password?');
    \DB::table('users')->insert([
    'name' => $name,
    'email' => $email,
    'password' => bcrypt($pwd),
    'created_at' => date_create()->format('Y-m-d H:i:s'),
    'updated_at' => date_create()->format('Y-m-d H:i:s'),
    ]);
    $this->info('Account created for '.$name);
    });