Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion artisan.md
Original file line number Diff line number Diff line change
Expand Up @@ -620,8 +620,13 @@ $name = $this->anticipate('What is your name?', ['Taylor', 'Dayle']);
Alternatively, you may pass a closure as the second argument to the `anticipate` method. The closure will be called each time the user types an input character. The closure should accept a string parameter containing the user's input so far, and return an array of options for auto-completion:

```php
use App\Models\Address;

$name = $this->anticipate('What is your address?', function (string $input) {
// Return auto-completion options...
return Address::whereLike('name', "{$input}%")
->limit(5)
->pluck('name')
->all();
});
```

Expand Down