Web-development is not all serious - there are some fun activities too. So let's have a break from mega-urgent code writing and get some inspiration. From our beloved Artisan - with a command "inspire".
It's not officially documented, but if you run php artisan inspire, you will get a random motivational quote right in your terminal. Like this.
How does it work? Well, if you ever looked at /routes folder, there are three files there:
- web.php - the one we generally use
- api.php - for projects with API
- console.php - this one is interesting for us now!
Let's take a look at routes/console.php:
use Illuminate\Foundation\Inspiring;
/*
|--------------------------------------------------------------------------
| Console Routes
|--------------------------------------------------------------------------
|
| This file is where you may define all of your Closure based console
| commands. Each Closure is bound to a command instance allowing a
| simple approach to interacting with each command's IO methods.
|
*/
Artisan::command('inspire', function () {
$this->comment(Inspiring::quote());
});
This is where we find that inspire command, and actually - the whole console.php file concept, which is not documented properly, is about routing your artisan commands like this, instead of going through app/Console/Kernel.php.
Is it really usable? Good question, since it's not really documented - I guess, Taylor didn't pay too much attention to it (maybe in the future?), so for now it's just a cool little thing to know.
I hope it inspires you for the upcoming 2017!
No comments or questions yet...