public function getStats() { $province = Province::all(); $array = []; foreach ($province as $p) { $array[] = [$p->name, $p->points()]; } return json_encode($array); }
private function _users() { $provinces = Province::all(); foreach ($provinces as $p) { $faker = \Faker\Factory::create(); $user = new User(); $user->name = $faker->name; $user->province_id = $p->id; $user->email = $faker->email; $user->password = Hash::make('123456'); $user->save(); $license = License::where('used', 0)->first(); $license->used = 1; $license->save(); $license->user()->attach($user); $score = new Score(); $score->score = rand(100, 3500); $score->license = $license->license; $score->save(); } }
public function getReceiverinfo (Request $request) { $user = Auth::user(); $receiverInfoSet = ReceiverInfo::where('uid', '=', $user->id) ->where('active', '=', '1') ->orderBy('last_used', 'desc') ->orderBy('created_at', 'desc') ->get(); $provinceSet = Province::all(); $provinces = array(); foreach ($provinceSet as $province) { array_push($provinces, $province); } $cities = City::all(); $districts = array(); foreach ($cities as $city) { $district = District::where('city_code', '=', $city->code) ->where('active', '=', '1') ->first(); if ($district) { array_push($districts, $district); } } $receiverInfos = array(); foreach ($receiverInfoSet as $receiverInfo) { array_push($receiverInfos, $receiverInfo); } $data = [ 'receiverInfos' => $receiverInfos, 'provinces' => $provinces, 'cities' => $cities, 'districts' => $districts, 'receiverActive' => true, 'wTitle' => '个人中心 - 收货人信息' ]; return view('profile/receiver_info', $data); }
public function getProvince($id = NULL) { return $id == NULL ? Province::all() : Province::find($id); }
public function index() { $title = 'Statistieken'; $province = Province::all(); return view('stats.index', compact('title', 'province')); }
public function getProvince (Request $request) { $provinces = Province::all(); $html = $this->provinceList($provinces); return $this->successResponse('res', $html); }
/** * Show the application dashboard. * * @return Response */ public function index() { $title = 'Homepagina'; $provinces = Province::all(); return view('home.index', compact('title', 'provinces')); }