public function create($category = 0) { $category = intval($category); if ($category > 0) { $category = Category::findOrFail($category); } $categories = Category::roots()->get(); $user = Auth::user(); $states = Location::states()->first(); $regions = $states->children()->first(); $locations = $regions->children; return view('pages.task.create', compact('category', 'categories', 'user', 'locations')); }
public function create() { $pid = intval(Input::get('id', 0)); if ($pid != 0) { $location = Location::findOrFail($pid); if ($location->pid == 0) { $parents = Location::states()->get(); } else { $parents = $location->siblings(); } } else { $location = false; $parents = Location::states()->get(); } return view('admin.pages.location.add', compact('location', 'parents', 'pid')); }
public function getFill() { if (!$this->checkProfileType()) { return redirect('/profile'); } if ($this->checkProfileFill()) { return redirect('/profile'); } $user = $this->user; $profile = $this->user->profile; $city = $profile->city; if ($city) { $region = $city->parent; } else { $region = Location::states()->first()->children()->first(); } $cities = $region->children; $categories = Category::roots()->get(); $subscribePeriods = ['asap', 'hour', 'twice-day', 'day', 'two-days']; return view('pages.profile.fill', compact('user', 'profile', 'cities', 'categories', 'subscribePeriods')); }
public function getRegisterTasker() { $states = Location::states()->get(); $regions = $states->first()->children; $cities = $regions->first()->children; $citiesArr = ['' => trans('register.city.placeholder')]; $regionsArr = []; $statesArr = []; foreach ($cities as $s) { $citiesArr[$s->id] = $s->title; } foreach ($regions as $s) { $regionsArr[$s->id] = $s->title; } foreach ($states as $s) { $statesArr[$s->id] = $s->title; } $cities = $citiesArr; $states = $statesArr; $regions = $regionsArr; return view('pages.register.tasker', compact('states', 'regions', 'cities')); }