Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependency Injection Issue #142

Open
aivisionbot opened this issue Dec 30, 2023 · 1 comment
Open

Dependency Injection Issue #142

aivisionbot opened this issue Dec 30, 2023 · 1 comment

Comments

@aivisionbot
Copy link

aivisionbot commented Dec 30, 2023

hello , i use livewire 3 and livewire-alert": "^3.0.1

i use this code in my component :

       public function connect(Bot $bot)
          {
              $this->alert('question', '', [
                  'position' => 'center',
                  'timer' => false,
                  'toast' => false,
                  'text' => 'Have you connected your account with Pamm Link ? Enter Pamm Code : ',
                  'timerProgressBar' => true,
                  'showConfirmButton' => true,
                  'input' => 'number',
                  'confirmButtonText' => 'Submit',
                  'onConfirmed' => 'confirmedConnectBot' ,
                  'inputAttributes' => [
                      'bot' => $bot->id ,
                  ],
                  'showCancelButton' => true,
                  'cancelButtonText' => 'Cancel',
              ]);
          }
          
           #[On('confirmedConnectBot')]
          public function confirmedConnectBot($response)
          {
      
              $bot = $response['data']['inputAttributes']['bot'];
      
              $pamm_code = $response['value'] ;
           }

but i get this error :
Unable to resolve dependency [Parameter #0 [ $response ]] in class App\Livewire\User\Bot\LastRequests

@matticustard
Copy link

I realize this issue is 4 months old but I had the same issue after upgrading to Livewire 3. It appears that the parameter must now be named $data instead of $response and the new parameter is the equivalent of the old $response['data'].

The new structure looks like this:

public function confirmedMethod($data)
{
    $value = $data['inputAttributes']['value'];

    // ...
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants