本文整理匯總了PHP中app\models\Location::states方法的典型用法代碼示例。如果您正苦於以下問題:PHP Location::states方法的具體用法?PHP Location::states怎麽用?PHP Location::states使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類app\models\Location
的用法示例。
在下文中一共展示了Location::states方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: create
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'));
}
示例2: create
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'));
}
示例3: getFill
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'));
}
示例4: getRegisterTasker
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'));
}