private function _getRowData($row)
 {
     $cityName = trim(keepOnlyChineseWord(array_get($row, 0)));
     $stateName = trim(keepOnlyChineseWord(array_get($row, 1)));
     $city = City::findByName($cityName)->first();
     $state = NULL !== $city ? State::findByName($stateName)->first() : NULL;
     $zipcode = NULL !== $state ? $state->zipcode : '';
     return '' !== $zipcode ? [$cityName, $stateName, $zipcode] : [array_get($row, 0), array_get($row, 1), ''];
 }
 public function create()
 {
     if (!$this->user || !$this->user->isClerk()) {
         $this->alert('info', 'Only Managers can create assets.', false);
     }
     $this->view->title = 'Create Asset';
     $this->view->breadcrumbs = ['assets' => 'Assets', 'assets/create' => 'Create'];
     $this->view->states = State::all();
     $this->view->suburbs = Suburb::all();
     $this->view->asset = new Asset();
     return $this->view;
 }
 private function _prevSetContentState(&$content, ImportContentRequest $request)
 {
     $state = State::where('zipcode', '=', $request->get('zipcode'))->where(function ($q) use($request) {
         $q->where('name', '=', $request->get('district'))->orWhere('pastname', '=', $request->get('district'));
     })->first();
     $content->state_id = NULL === $state ? NULL : $state->id;
 }
 public function zipcode($attribute, $value, $parameters, $validator)
 {
     $value = $this->filter->_getZipcode($value);
     return Import::DEFAULT_ZIPCODE === $value || NULL !== State::findByZipcode($value)->first();
 }
Example #5
0
 public function _guessAddressTypeC($address)
 {
     $states = State::findByName(mb_substr($address, 0, 3, Import::DOC_ENCODE))->get();
     if (1 !== count($states)) {
         return NULL;
     }
     return array_get($states, 0);
 }