System: You are a rock-star php developer.
User: Consider the following declarations:

```php
<?php

namespace App\Livewire;

use Livewire\Component;
use Livewire\WithPagination;

class Messages extends Component
{
  public function render()
  {
    return view('livewire.dashboard.admin.send-message-content');
  }
}

```


```php
<?php

namespace App\Enums;

enum QueueMessageType: string
{
    case Commercial = 'Commercial';
    case Information = 'Information';
    case Authentication = 'Authentication';
}

```


```blade
<div>

  <div class="py-4">
    <div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
      <div class="bg-white dark:bg-gray-800 overflow-hidden shadow sm:rounded-lg">
        <div class="p-6 text-gray-900 dark:text-gray-100">

          <form wire:submit.prevent="sendMessage" class="space-y-8 divide-y divide-gray-200 dark:divide-gray-700">
            <div class="space-y-8 sm:space-y-5">
              <div>
                <div class="mt-6 sm:mt-5 space-y-6 sm:space-y-5">

                  <div class="sm:grid sm:grid-cols-3 sm:gap-4 sm:items-start sm:border-gray-200 sm:pt-5">
                    <label for="about"
                           class="block text-sm font-medium text-gray-500 dark:text-gray-200 sm:mt-px sm:pt-2"> {{ __('Message') }} </label>
                    <div class="mt-1 sm:mt-0 sm:col-span-2">
                      <textarea id="message" name="message" rows="3"
                                class="shadow-sm block w-full focus:ring-indigo-500 focus:border-indigo-500
                                sm:text-sm border border-gray-300 dark:border-gray-600 rounded-md dark:bg-gray-700"></textarea>
                      <p
                        class="mt-2 text-sm text-gray-500 dark:text-gray-300">{{ __('dashboard.admin.send-message-hint') }}</p>
                    </div>
                  </div>

                </div>
              </div>
            </div>

            <div class="space-y-8 sm:space-y-5">
              <div>
                <div class="mt-6 sm:mt-5 space-y-6 sm:space-y-5">

                  <div class="sm:grid sm:grid-cols-3 sm:gap-4 sm:items-start sm:border-gray-200 sm:pt-5">
                    <label for="about"
                           class="block text-sm font-medium text-gray-500 dark:text-gray-200 sm:mt-px sm:pt-2"> {{ __('Type') }} </label>
                    <div class="mt-1 sm:mt-0 sm:col-span-2">

                      <fieldset>
                        <legend class="sr-only">Privacy setting</legend>
                        <div class="rounded-md -space-y-px">
                          <label
                            class="rounded-tl-md rounded-tr-md relative border dark:border-gray-500 p-4 flex cursor-pointer
                            focus:outline-none">
                            <input type="radio" name="message-type" value="Commercial"
                                   class="h-4 w-4 mt-0.5 cursor-pointer text-indigo-600 border-gray-300 focus:ring-indigo-500"
                                   aria-labelledby="privacy-setting-0-label"
                                   aria-describedby="privacy-setting-0-description">
                            <div class="mr-3 flex flex-col">
                              <span id="privacy-setting-0-label"
                                    class="block text-sm font-medium">{{ __('Commercial') }}</span>
                              <span id="privacy-setting-0-description" class="block text-sm text-gray-400">
                                {{ __('dashboard.admin.commercial-desc') }}
                              </span>
                            </div>
                          </label>

                          <label
                            class="rounded-bl-md rounded-br-md relative border dark:border-gray-500 p-4 flex
                            cursor-pointer focus:outline-none">
                            <input type="radio" name="message-type" value="Informational"
                                   class="h-4 w-4 mt-0.5 cursor-pointer text-indigo-600 border-gray-300 focus:ring-indigo-500"
                                   aria-labelledby="privacy-setting-1-label"
                                   aria-describedby="privacy-setting-1-description">
                            <div class="mr-3 flex flex-col">
                              <span id="privacy-setting-1-label"
                                    class="block text-sm font-medium"> {{ __('Informational') }} </span>
                              <span id="privacy-setting-1-description" class="block text-sm text-gray-400">
                                {{ __('dashboard.admin.information-desc') }}
                              </span>
                            </div>
                          </label>
                        </div>
                      </fieldset>
                    </div>
                  </div>

                </div>
              </div>
            </div>

            <div class="space-y-8 sm:space-y-5">
              <div>
                <div class="mt-6 sm:mt-5 space-y-6 sm:space-y-5">

                  <div class="sm:grid sm:grid-cols-3 sm:gap-4 sm:items-start sm:border-gray-200 sm:pt-5">
                    <label for="about"
                           class="block text-sm font-medium text-gray-500 dark:text-gray-200 sm:mt-px sm:pt-2"> {{ __('Group') }} </label>
                    <div class="mt-1 sm:mt-0 sm:col-span-2">

                      <fieldset>
                        <legend class="sr-only">Privacy setting</legend>
                        <div class="rounded-md -space-y-px">
                          <label
                            class="rounded-tl-md rounded-tr-md relative border dark:border-gray-500 p-4 flex cursor-pointer
                            focus:outline-none">
                            <input type="radio" name="user-group" value="all"
                                   class="h-4 w-4 mt-0.5 cursor-pointer text-indigo-600 border-gray-300 focus:ring-indigo-500"
                                   aria-labelledby="privacy-setting-0-label"
                                   aria-describedby="privacy-setting-0-description">
                            <div class="mr-3 flex flex-col">
                              <span id="privacy-setting-0-label"
                                    class="block text-sm font-medium">{{ __('All') }}</span>
                              <span id="privacy-setting-0-description" class="block text-sm text-gray-400">
                                {{ __('dashboard.admin.send-all-desc') }}
                              </span>
                            </div>
                          </label>

```


```php
<?php

use App\Enums\{QueueMessageStatus, QueueMessageType, SocialPlatform};
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration {
  /**
   * Run the migrations.
   */
  public function up(): void
  {
    Schema::create('queue_messages', function (Blueprint $table) {
      $table->id();
      $table->timestamps();
      $table->foreignId('user_id')->nullable()->constrained('users')->onDelete('set null');
      $table->foreignId('lead_id')->nullable()->constrained('leads')->onDelete('set null');
      $table->mediumText('content');
      $table->enum('type', array_column(QueueMessageType::cases(), 'value'));
      $table->enum('status', array_column(QueueMessageStatus::cases(), 'value'))->default(QueueMessageStatus::Pending);
      $table->enum('platform', array_column(SocialPlatform::cases(), 'value'));
      $table->tinyInteger('retry_count')->default(0);
    });
  }

  /**
   * Reverse the migrations.
   */
  public function down(): void
  {
    Schema::dropIfExists('queue_messages');
  }
};

```


What do you think, should something be inserted instead of <INSERT_CODE_HERE> in the document below or the document is already ok?

* If some code should be inserted then answer with new code to insert at the position <INSERT_CODE_HERE>.
* Don't generate any other text or explanation.
* Use comments and surrounding code to predic what is necessary instead of <INSERT_CODE_HERE>.
* You can generate oneline of code or multiple lines

Answer in the format:
CODE_TO_INSERT:
```php
<code>
```

Here is the original code:
```php
<?php

namespace App\Livewire;

use App\Enums\QueueMessageStatus;
use App\Models\QueueMessage;
use App\Models\User;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Support\Facades\Validator;
use Illuminate\Validation\ValidationException;
use Livewire\Component;
use App\Enums\QueueMessageType;

class Messages extends Component
{
  public $message;
  public $messageType = 'Commercial';
  public $userGroup = 'all';

  /**
   * Queue a message to a group or type of users based on the specified criteria.
   *
   * This method validates the input data, maps the message type to a corresponding
   * enum, retrieves the requested users, and prepares the messages for insertion
   * into the database. Finally, it dispatches an event indicating that the message
   * has been sent.
   *
   * @return void
   *
   * @throws ValidationException If the validation fails.
   */
  public function sendMessage(): void
  {
    $validatedData = Validator::make([
      'message' => $this->message,
      'messageType' => $this->messageType,
      'userGroup' => $this->userGroup,
    ], [
      'message' => 'required|string|max:1023<INSERT_CODE_HERE>',
      'messageType' => 'required|in:Commercial,Informational',
      'userGroup' => 'required|in:all,authenticated,unauthenticated,in_progress,premium',
    ])->validate();

    // Map messageType to QueueMessageType enum
    $messageType = QueueMessageType::tryFrom($validatedData['messageType']);

    $users = $this->getRequestedUsers();
    $messages = $users->map(function (User $user) use ($messageType) {
      return [
        'message' => $this->message,
        'user_id' => $user->id,
        'type' => $messageType,
        'status' => QueueMessageStatus::Pending,
      ];
    })->toArray();

    QueueMessage::insert($messages);

    $this->message = '';
    $this->dispatch('messageSent');
  }

  private function getRequestedUsers(): Collection
  {
    if ($this->userGroup === 'all') {
      return User::all();
    }
    return User::where('authentication_status', $this->userGroup)->get();
  }

  public function render()
  {
    return view('livewire.dashboard.admin.send-message-content');
  }
}

```
Assistant: