Skip to content
This repository has been archived by the owner on May 9, 2023. It is now read-only.

Event listener only return first parameter #72

Closed
lesaff opened this issue Nov 10, 2015 · 6 comments
Closed

Event listener only return first parameter #72

lesaff opened this issue Nov 10, 2015 · 6 comments
Labels

Comments

@lesaff
Copy link

lesaff commented Nov 10, 2015

Parameter output from the listener

screen shot 2015-11-10 at 6 36 07 am

When I dd($parameters) on line 64 in the StatamicController.php it returns

screen shot 2015-11-10 at 6 36 39 am

@lesaff lesaff added the bug label Nov 10, 2015
@jasonvarga
Copy link
Member

That's intentional.

@lesaff
Copy link
Author

lesaff commented Nov 10, 2015

Any other ways to pass multiple parameters to the URL?

@jasonvarga
Copy link
Member

Each additional segment is an argument.

!/stockquotes/getjson/YHOO/AAPL/MSFT
class StockQuotesListener extends Listener {
  public $events = [
    'stockquotes.getjson' => 'json'
  ];

  public function json($one, $two, $three) {
    dd($one, $two, $three);
    // 'YHOO'
    // 'AAPL'
    // 'MSFT'
  }
}

If you want an unlimited number of parameters, do this instead:

  public function json() {
    dd(func_get_args());
    // ['YHOO', 'AAPL', 'MSFT']
  }

@lesaff
Copy link
Author

lesaff commented Nov 10, 2015

Thank you, that works for me. Shall we close this issue or leave it for informational purpose?

@jasonvarga
Copy link
Member

Shut it down! :) ⚓

@jackmcdade
Copy link
Member

CLOSE IT. It lives on forever.

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

No branches or pull requests

3 participants