Skip to content

Instantly share code, notes, and snippets.

@Stichoza
Created February 5, 2016 19:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Stichoza/982f9841bce536250128 to your computer and use it in GitHub Desktop.
Save Stichoza/982f9841bce536250128 to your computer and use it in GitHub Desktop.
A small console command (php artisan winner) I wrote for generating a winner from attendees at Laravel meet-up.
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
class SayWinner extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'winner';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Get the random winner!';
/**
* Users
* @var [type]
*/
private $users = [
'Tamaz Bagdavadze',
'Zura Gabievi',
'Guram Gunia',
'Levan Lotuashvili',
'Mako',
'Landish',
'Giorgi Bakashvili',
'Shalva Gelenidze',
'Shota Jolbordi',
'Dito Orkodashvili',
'Davit Khurtsidze',
'Giorgi Leivdze',
'Sandro Dolidze',
'Irakli the 5th',
'Guram Sutidze',
'Nana',
'Giorgi Goginashvili',
'Mariam Vardanidze',
'Giorgi Eufshi',
'Lasha Mgvdliashvili',
'Giorgi Beraia',
'Abesalomi Gogatishvili',
'Beqa Bendeliani',
'Giorgi Giorkhelidze',
'Levan Lekishvili',
'Ana Chikvaidze',
'Lasha Sumbadze',
'Ilya Gokadze',
'Ani Jujunashvili',
'Eka Vatsadze',
'Sergi Biganashvili',
'Giorgi Khachidze',
'Giorgi Pailodze',
'Mariam Komaxide',
'Salikh Gurgenidze',
'Merab Kutalia',
'Giorgi Monaselidze'
];
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
shuffle($this->users);
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
sleep(2);
$this->info('Thinking...');
sleep(6);
$this->info('Hmmmmm... And the Laracasts one month subscription goes to...');
sleep(3);
$this->info( last($this->users) );
sleep(1);
$this->info( 'Congrats!' );
}
}
@shakogele
Copy link

Good :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment