The current version of the code hardcodes the name of the chat when saving to the database. For example, [supergroup] Foo.
This is inconvenient when you need to display the list of channels without prefixes.
In such cases we have to create casts for the name field of the model to apply a regular expression to remove the prefix.
To solve this problem, I propose to consider two interrelated actions at once:
Put the formation of the chat name into an external protected method that developers can easily override to change the logic.
also put the method of chat creation into an external method in case some of the developers need to add their own logic when saving, having access to the DefStudio\Telegraph\DTO\Chat object.
The current version of the code hardcodes the name of the chat when saving to the database. For example,
[supergroup] Foo
.This is inconvenient when you need to display the list of channels without prefixes.
In such cases we have to create casts for the
name
field of the model to apply a regular expression to remove the prefix.To solve this problem, I propose to consider two interrelated actions at once:
DefStudio\Telegraph\DTO\Chat
object.