First Commit

This commit is contained in:
marco
2026-09-01 07:49:48 -03:00
commit 28b1044038
399 changed files with 41659 additions and 0 deletions
+62
View File
@@ -0,0 +1,62 @@
<?php
declare(strict_types=1);
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* Represents a Telegram user connection with their own bot configuration.
*
* @property int $id
* @property int $user_id
* @property string $telegram_user_id
* @property string|null $bot_token User's own Telegram bot token
* @property string|null $bot_username User's own Telegram bot username
* @property string|null $chat_id Telegram chat ID for sending messages
* @property string|null $telegram_username
* @property string|null $telegram_first_name
* @property string|null $telegram_last_name
* @property bool $is_active
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @property-read User $user
*/
class TelegramUser extends Model
{
/** @var array<int, string> */
protected $fillable = [
'user_id',
'telegram_user_id',
'bot_token',
'bot_username',
'chat_id',
'telegram_username',
'telegram_first_name',
'telegram_last_name',
'is_active',
];
/** @var array<string, string> */
protected $casts = [
'is_active' => 'boolean',
];
/**
* Get the user associated with this telegram user.
*/
public function user(): BelongsTo
{
return $this->belongsTo(User::class);
}
/**
* Check if the user has a fully configured bot.
*/
public function isFullyConfigured(): bool
{
return !empty($this->bot_token) && !empty($this->chat_id);
}
}