private function viewUserStore(array $data) { return view('add-store', $data)->withUser(Auth::user()->id)->withStores(Auth::user()->stores)->withTypes(collect(Store::types()))->withAreaCodes(collect(User::areaCodes()))->withStates(Auth::user()->getStatesPaginated(10))->withPostCodes(Auth::user()->getPostCodesPaginated(10)); }
public static function decodePhoneNumber($phone_number) { $keywords = preg_split("/[-]+/", $phone_number); if (count($keywords) == 1) { return [4, $keywords[0]]; } $phone_number = $keywords[1]; foreach (User::areaCodes() as $key => $value) { if ($value == $keywords[0]) { return [$key, $phone_number]; } } return [5, '']; }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit(User $user) { return view('edit-profile')->withUser($user)->withPhoneNumber(User::decodePhoneNumber($user->phone_number))->withAddress(User::decodeAddress($user->address))->withAreaCodes(collect(User::areaCodes()))->withStates($user->getStatesPaginated(10))->withPostCodes($user->getPostCodesPaginated(10)); }