Laravel 10.xのartisanの「make:channel」コマンドを解説します。
Description
新しいチャンネルクラスを作成します。
Usage
php artisan make:channel [-f|--force] [--] <name>
Arguments
引数 | 必須 | 説明 |
---|---|---|
name | 必須 | チャンネル名 |
Options
オプション | 省略形 | 必須 | 説明 |
---|---|---|---|
force | f | - | チャンネルが既に存在する場合でも、クラスを作成する |
Examples
no options
php artisan make:channel Foo
INFO Channel [app/Broadcasting/Foo.php] created successfully.
<?php
namespace App\Broadcasting;
use App\Models\User;
class Foo
{
/**
* Create a new channel instance.
*/
public function __construct()
{
//
}
/**
* Authenticate the user's access to the channel.
*/
public function join(User $user): array|bool
{
//
}
}
Stub
Option | Stub file name |
---|---|
- | channel.stub |
Source
10.x
framework/src/Illuminate/Foundation/Console/ChannelMakeCommand.php at 10.x · laravel/framework
The Laravel Framework. Contribute to laravel/framework development by creating an account on GitHub.
11.x
framework/src/Illuminate/Foundation/Console/ChannelMakeCommand.php at 11.x · laravel/framework
The Laravel Framework. Contribute to laravel/framework development by creating an account on GitHub.
コメント