forked from mpociot/chuck-norris-jokes
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
69 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace Mpociot\ChuckNorrisJokes; | ||
|
||
use Illuminate\Support\ServiceProvider; | ||
use Mpociot\ChuckNorrisJokes\Console\ChuckNorrisJoke; | ||
use Mpociot\ChuckNorrisJokes\JokeFactory; | ||
|
||
class ChuckNorrisJokesServiceProvider extends ServiceProvider | ||
{ | ||
public function boot() | ||
{ | ||
if ($this->app->runningInConsole()) { | ||
$this->commands([ | ||
ChuckNorrisJoke::class | ||
]); | ||
} | ||
} | ||
|
||
public function register() | ||
{ | ||
$this->app->bind('chuck-norris', function() { | ||
return new JokeFactory(); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
namespace Mpociot\ChuckNorrisJokes\Console; | ||
|
||
use Illuminate\Console\Command; | ||
use Mpociot\ChuckNorrisJokes\Facades\ChuckNorris; | ||
|
||
class ChuckNorrisJoke extends Command | ||
{ | ||
protected $signature = 'chuck-norris'; | ||
|
||
protected $description = 'Output a funny Chuck Norris joke.'; | ||
|
||
public function handle() | ||
{ | ||
$this->info(ChuckNorris::getRandomJoke()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
namespace Mpociot\ChuckNorrisJokes\Facades; | ||
|
||
use Illuminate\Support\Facades\Facade; | ||
|
||
class ChuckNorris extends Facade | ||
{ | ||
protected static function getFacadeAccessor() | ||
{ | ||
return 'chuck-norris'; | ||
} | ||
} |