Skip to content

Commit a2b1d7d

Browse files
committed
clean widget support
1 parent 676ad63 commit a2b1d7d

File tree

3 files changed

+7
-22
lines changed

3 files changed

+7
-22
lines changed

src/Conversation.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
use Illuminate\Foundation\Auth\User;
1414

1515
/**
16+
* @property int $id
1617
* @property Collection $users
18+
* @property ?int $owner_id
1719
* @property ?User $owner
1820
* @property Collection<int, Message> $messages
1921
* @property Collection<int, User> $users
@@ -43,7 +45,7 @@ protected static function booted(): void
4345
* We choose to not use onCascade Delete at the database level for 3 reasons:
4446
* - Transactions performance
4547
* - Compatibility with cloud database like PlanetScale and Vitess
46-
* - Flexibility: so you can choose how to deal with it
48+
* - Flexibility: You can choose how to deal with it
4749
*/
4850
static::deleting(function (Conversation $conversation) {
4951
$conversation->users()->detach();

src/Message.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use League\CommonMark\MarkdownConverter;
1515

1616
/**
17+
* @property int $id
1718
* @property ?string $content
1819
* @property ?array $widget
1920
* @property int $conversation_id
@@ -111,6 +112,8 @@ public function setWidget(string $componentName, array $props): static
111112

112113
public function getWidgetProps(): array
113114
{
114-
return data_get($this->widget, 'props', []);
115+
return array_merge(data_get($this->widget, 'props', []), [
116+
'message' => $this,
117+
]);
115118
}
116119
}

src/WidgetExample.php

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)