public function getLocations(Request $request) { $locationId = $request->input('depdrop_parents')[0]; $location = Location::find($locationId); if (!$locationId or !$location) { return ['output' => []]; } $locations = $location->children()->select('id', 'name')->get()->toArray(); return ['output' => $locations]; }
public function test_can_update_address() { $user = $this->createUser(); $address = $this->createAddress($user); $this->asUser($user)->visitAddressesIndexPage()->put($this->updateUrl($address), ['recipient' => '测试收件人', 'street' => '测试街道地址', 'phone' => '54321', 'city_id' => $cityId = Location::inRandomOrder()->city()->first()->id, 'postcode' => 'random-postcode'])->followRedirects()->seeSuccessMessage('修改成功')->seeAll('测试收件人', '测试街道地址', '54321', Location::find($cityId)->name, 'random-postcode'); }