【Laravel】artisanのmake:channelコマンドを解説

Laravel

Laravel 10.xのartisanの「make:channel」コマンドを解説します。

Description

新しいチャンネルクラスの作成

Usage

php artisan make:channel [-f|--force] [--] <name>

Arguments

引数必須説明
name必須チャンネル名

Options

オプション省略形必須説明
forcef-チャンネルが既に存在する場合でも、クラスを作成する

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
    {
        //
    }
}

Follow me!

コメント

PAGE TOP
タイトルとURLをコピーしました