File tree Expand file tree Collapse file tree 1 file changed +20
-4
lines changed
Expand file tree Collapse file tree 1 file changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -12,19 +12,35 @@ composer require dillingham/nova-ajax-select
1212
1313### Usage
1414
15- ``` php
15+ Specify a url for the field to retrieve data from
16+
17+ Optionally, specifiy a parent() ` attribute ` to trigger the query:
1618
19+ ``` php
1720BelongsTo::make('Company'),
1821
19- AjaxSelect::make('Employee ')
20- ->get('/api/employees /{company}')
22+ AjaxSelect::make('Users ')
23+ ->get('/api/company /{company}/users ')
2124 ->parent('company'),
2225```
2326
27+ Example Endpoint
28+
29+ ``` php
30+ Route::get('api/company/{company}/users', function($company_id) {
31+
32+ $company = \App\Company::findOrFail($company_id);
33+
34+ return $company->users->map(function($user) {
35+ return ['key' => $user->id, 'display' => $user->name ];
36+ });
37+ });
38+ ```
39+
2440### Url Options
2541
2642| parameter | description | value |
2743| - | - | - |
2844| {resource-name} | the resource name | "Order" |
2945| {resource-id} | the resource being edited | "11"
30- | {parent} | put the attribute not ie {employee } | "22" |
46+ | {parent} | put the attribute ie {company } | "22" |
You can’t perform that action at this time.
0 commit comments