Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Dillingham committed Feb 10, 2019
1 parent 3b14398 commit 5fe6a28
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,35 @@ composer require dillingham/nova-ajax-select

### Usage

```php
Specify a url for the field to retrieve data from

Optionally, specifiy a parent() `attribute` to trigger the query:

```php
BelongsTo::make('Company'),

AjaxSelect::make('Employee')
->get('/api/employees/{company}')
AjaxSelect::make('Users')
->get('/api/company/{company}/users')
->parent('company'),
```

Example Endpoint

```php
Route::get('api/company/{company}/users', function($company_id) {

$company = \App\Company::findOrFail($company_id);

return $company->users->map(function($user) {
return ['key' => $user->id, 'display' => $user->name ];
});
});
```

### Url Options

| parameter | description | value |
| - | - | - |
| {resource-name} | the resource name | "Order" |
| {resource-id} | the resource being edited | "11"
| {parent} | put the attribute not ie {employee} | "22" |
| {parent} | put the attribute ie {company} | "22" |

0 comments on commit 5fe6a28

Please sign in to comment.