forked from eatvio/eatvio-infra
static analizys update
This commit is contained in:
@@ -5,25 +5,28 @@ namespace App\Livewire\Chat;
|
||||
use App\Events\ChatMessageUpdated;
|
||||
use App\Models\Chat;
|
||||
use App\Models\User;
|
||||
use Illuminate\Contracts\View\Factory as ViewFactory;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Support\Collection;
|
||||
use Livewire\Component;
|
||||
|
||||
class MessageWindow extends Component
|
||||
{
|
||||
public $messages = [];
|
||||
public Collection $messages;
|
||||
|
||||
public $curMessage = '';
|
||||
public string $curMessage = '';
|
||||
|
||||
public $curUserId;
|
||||
public int $curUserId;
|
||||
|
||||
public $recipientUserId;
|
||||
public int $recipientUserId;
|
||||
|
||||
public $recipientUser;
|
||||
public User $recipientUser;
|
||||
|
||||
public $chanId;
|
||||
public string $chanId;
|
||||
|
||||
public $curUser;
|
||||
public User $curUser;
|
||||
|
||||
public function getListeners()
|
||||
public function getListeners(): array
|
||||
{
|
||||
return [
|
||||
'echo-private:direct-chat.'.$this->chanId.',ChatMessageUpdated' => 'notifyNewMessage',
|
||||
@@ -33,7 +36,7 @@ class MessageWindow extends Component
|
||||
];
|
||||
}
|
||||
|
||||
public function notifyNewMessage($e): void
|
||||
public function notifyNewMessage(array $e): void
|
||||
{
|
||||
$message = $e['message'];
|
||||
|
||||
@@ -41,11 +44,11 @@ class MessageWindow extends Component
|
||||
->prepend($message);
|
||||
}
|
||||
|
||||
public function updateRecipientId($id = null)
|
||||
public function updateRecipientId(?int $id = null): void
|
||||
{
|
||||
}
|
||||
|
||||
public function whisperTypeing()
|
||||
public function whisperTypeing(): void
|
||||
{
|
||||
$this->dispatch(
|
||||
'typing',
|
||||
@@ -58,7 +61,7 @@ class MessageWindow extends Component
|
||||
}
|
||||
|
||||
// FIXME
|
||||
public function mount($recipientUserId)
|
||||
public function mount(?int $recipientUserId): void
|
||||
{
|
||||
$this->recipientUserId = $recipientUserId;
|
||||
$this->recipientUser = User::find($recipientUserId);
|
||||
@@ -68,18 +71,18 @@ class MessageWindow extends Component
|
||||
// ? $recipientUserId . "_" . $this->curUserId
|
||||
// : $this->curUserId . "_" . $recipientUserId;
|
||||
if (is_null($recipientUserId)) {
|
||||
$this->messages = [];
|
||||
$this->messages = collect([]);
|
||||
} else {
|
||||
$this->messages = (new Chat())->withLastTenMessages($this->curUserId, $recipientUserId)->get();
|
||||
}
|
||||
}
|
||||
|
||||
public function render()
|
||||
public function render(): View|ViewFactory
|
||||
{
|
||||
return view('livewire.chat.message-window');
|
||||
}
|
||||
|
||||
public function sendChatMessage()
|
||||
public function sendChatMessage(): void
|
||||
{
|
||||
$chatMessage = [
|
||||
'data' => $this->curMessage,
|
||||
|
||||
Reference in New Issue
Block a user