36 lines
1.2 KiB
PHP
36 lines
1.2 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Websocket\Controllers;
|
||
|
|
|
||
|
|
use App\Actions\Chat;
|
||
|
|
use App\Websocket\GameController;
|
||
|
|
|
||
|
|
/** chat.channels|history|open|send|read, each with world_id; channels are world, tribe and dm:<player id>. */
|
||
|
|
class ChatController extends GameController
|
||
|
|
{
|
||
|
|
public function channels()
|
||
|
|
{
|
||
|
|
return $this->play(fn () => app(Chat::class)->channels(auth()->user(), (int) request('world_id')));
|
||
|
|
}
|
||
|
|
|
||
|
|
public function history()
|
||
|
|
{
|
||
|
|
return $this->play(fn () => app(Chat::class)->history(auth()->user(), (int) request('world_id'), (string) request('channel'), request('before') ? (int) request('before') : null));
|
||
|
|
}
|
||
|
|
|
||
|
|
public function open()
|
||
|
|
{
|
||
|
|
return $this->play(fn () => app(Chat::class)->open(auth()->user(), (int) request('world_id'), (string) request('player')));
|
||
|
|
}
|
||
|
|
|
||
|
|
public function send()
|
||
|
|
{
|
||
|
|
return $this->play(fn () => app(Chat::class)->send(auth()->user(), (int) request('world_id'), (string) request('channel'), (string) request('body')));
|
||
|
|
}
|
||
|
|
|
||
|
|
public function read()
|
||
|
|
{
|
||
|
|
return $this->play(fn () => app(Chat::class)->read(auth()->user(), (int) request('world_id'), (string) request('channel')));
|
||
|
|
}
|
||
|
|
}
|