console.php 1.0 KB

12345678910111213141516171819202122232425262728
  1. <?php
  2. use Illuminate\Foundation\Inspiring;
  3. use Illuminate\Support\Facades\Artisan;
  4. use App\Commands\CreateCrud;
  5. use App\Commands\RefreshPermissions;
  6. use App\Commands\TestWebsocketEvent;
  7. Artisan::command('inspire', function () {
  8. $this->comment(Inspiring::quote());
  9. })->purpose('Display an inspiring quote');
  10. Artisan::command('create:crud {name}', function ($name) {
  11. $this->call(CreateCrud::class, ['name' => $name]);
  12. })->purpose('Create a CRUD for a given model');
  13. Artisan::command('permissions:refresh', function () {
  14. $this->call(RefreshPermissions::class);
  15. })->purpose('Refresh all permissions and user type permissions');
  16. Artisan::command('websocket:test {room} {--event=test-event} {--data=}', function () {
  17. // Pass through all arguments and options to the command class
  18. $this->call(TestWebsocketEvent::class, [
  19. 'room' => $this->argument('room'),
  20. '--event' => $this->option('event'),
  21. '--data' => $this->option('data'),
  22. ]);
  23. })->purpose('Test websocket broadcasting by emitting an event');