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

WIP: dependsOn filters #2

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
10 changes: 10 additions & 0 deletions Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,16 @@ public function registerNavigation()
'icon' => 'icon-database',
'url' => Backend::url('winter/test/locations'),
],
'cities' => [
'label' => 'Cities',
'icon' => 'icon-database',
'url' => Backend::url('october/test/cities'),
],
'locations' => [
'label' => 'Locations',
'icon' => 'icon-database',
'url' => Backend::url('october/test/locations'),
],
],
],
];
Expand Down
2 changes: 1 addition & 1 deletion models/city/columns.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ columns:
name:
label: Name
searchable: true

country_name:
label: Country
relation: country
Expand Down
2 changes: 1 addition & 1 deletion models/city/fields.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ fields:
label: Country
type: relation
span: right

27 changes: 27 additions & 0 deletions updates/seed_tables.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,33 @@ public function run()
['country_id' => $country2->id, 'city_id' => 8, 'name' => '2322 Xray Alphabet'],
]);

/*
* Test 9: Locations
*/
$cities = [
$country1->id => ['Regina', 'Vancouver', 'Toronto', 'Ottawa'],
$country2->id => ['New York', 'Seattle', 'Boston', 'San Francisco'],
];

$insertCities = [];
foreach ($cities as $countryId => $cityNames) {
foreach ($cityNames as $name) {
$insertCities[] = ['country_id' => $countryId, 'name' => $name];
}
}

City::insert($insertCities);
Location::insert([
['country_id' => $country1->id, 'city_id' => 1, 'name' => '240 5th Ave'],
['country_id' => $country1->id, 'city_id' => 2, 'name' => '101 McKay Street'],
['country_id' => $country1->id, 'city_id' => 3, 'name' => '123 Nowhere Lane'],
['country_id' => $country1->id, 'city_id' => 4, 'name' => '10099 Bob Loop'],
['country_id' => $country2->id, 'city_id' => 5, 'name' => '9442 Scary Street'],
['country_id' => $country2->id, 'city_id' => 6, 'name' => '5309 Imagination Crescrent'],
['country_id' => $country2->id, 'city_id' => 7, 'name' => '22 2201 Seymour Drive'],
['country_id' => $country2->id, 'city_id' => 8, 'name' => '2322 Xray Alphabet'],
]);

/*
* Test 5: Reviews
*/
Expand Down