Example #1
0
 public function showFromID($id)
 {
     $districts = District::where('province_id', $id)->get();
     foreach ($districts as $reg) {
         $prov = Province::where('region_id', $reg->id)->orderBy('name')->get();
         array_push($provinces, $prov);
     }
     dd($id);
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(ProvinceRequest $request)
 {
     $province = Province::where('id', $request['provinceID'])->first();
     $province->name = $request['name'];
     $province->updated_by = \Auth::user()->id;
     $province->save();
     \Session::flash('success', 'well done! Role ' . $request['name'] . ' has been successfully added!');
     return redirect()->back();
 }
Example #3
0
 /**
  * Find a site based on province, city and slug input
  *
  * @param string $province
  * @param string $city
  * @param string $slug
  *
  * @return mixed
  */
 public function findByProvinceCity($province, $city, $slug)
 {
     $p = new Province();
     $province = $p->where('slug', $province)->first();
     $c = new City();
     $city = $c->where(['province_id' => $province->id, 'slug' => $city])->first();
     $s = new Site();
     $site = $s->where(['city_id' => $city->id, 'slug' => $slug])->first();
     return $site;
 }
Example #4
0
 public function select(Poll $poll)
 {
     $provinces = Province::where('parent_id', null)->lists('name', 'id');
     $provinces[0] = 'اهمیتی ندارد';
     $cities = Province::where('parent_id', null)->firstOrFail()->getDescendants()->lists('name', 'id');
     $cities[0] = 'اهمیتی ندارد';
     $firstSkillCat = Category::where('parent_id', null)->lists('name', 'id');
     $firstSkillCat[0] = 'اهمیتی ندارد';
     $secondSkillCat = Category::where('parent_id', null)->firstOrFail()->getDescendants()->lists('name', 'id');
     $secondSkillCat[0] = 'اهمیتی ندارد';
     return view('store.poll.publish')->with(['title' => 'دریافت کنندگان نشر سنجی', 'provinces' => $provinces, 'cities' => $cities, 'firstSkillCat' => $firstSkillCat, 'secondSkillCat' => $secondSkillCat, 'poll' => $poll, 'hasFilters' => true]);
 }
Example #5
0
 /**
  * @return mixed
  */
 public function getProvince()
 {
     $province = Input::get('province');
     if (Input::has('year')) {
         $year = Input::get('year');
     } else {
         $year = 2014;
     }
     $result = Province::where('province', '=', $province)->where('year', '=', $year)->first();
     $img = Image::where('province', '=', $province)->first();
     $image = $img->image;
     return View::make('public.province')->with('province', $result)->with('image', $image)->with('year', $year);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $districts = ['Quận 1', 'Quận 2', 'Quận 3', 'Quận 4', 'Quận 5', 'Quận 6', 'Quận 7', 'Quận 8', 'Quận 9', 'Quận Thủ Đức', 'Quận Bình Thạnh', 'Quận Phú Nhuận', 'Quận Tân Phú', 'Quận Tân Bình', 'Huyện Hóc Môn', 'Huyện Bình Chánh', 'Huyện Nhà Bè', 'Huyện Củ Chi', 'Huyện Cần Giờ'];
     $provinces = Province::where('is_publish', 1)->orderBy('priority')->take(1)->get();
     $province_id = 1;
     if (is_null($provinces) || $provinces->count() == 0) {
         $province_id = $provinces[0]->id;
     }
     foreach ($districts as $key => $value) {
         $district = district::create(['key' => Common::createKeyURL($value), 'province_id' => $province_id, 'priority' => $key, 'is_publish' => 1, 'created_by' => 'vankhoe', 'updated_by' => 'vankhoe']);
         DistrictTranslation::create(['district_id' => $district->id, 'locale' => 'vi', 'name' => $value, 'meta_description' => 'Bán căn hộ ' . $value . ', sang nhượng căn hộ ' . $value . ', cho thuê căn hộ ' . $value, 'meta_keywords' => 'Bán căn hộ ' . $value . ', sang nhượng căn hộ ' . $value . ', cho thuê căn hộ ' . $value]);
     }
 }
Example #7
0
 public function index()
 {
     $user = Auth::user();
     $info = $user->info()->with('user')->firstOrCreate(['user_id' => $user->id]);
     $provinces = Province::where('parent_id', null)->lists('name', 'id');
     if (!is_null($info->province_id)) {
         $cities = Province::where('parent_id', $info->province_id)->lists('name', 'id');
     } else {
         $cities = Province::where('parent_id', null)->firstOrFail()->getDescendants()->lists('name', 'id');
     }
     $location = $user->location()->firstOrCreate(['user_id' => $user->id]);
     $advantages = Advantage::get();
     $shop = $user->shop;
     if (count($shop)) {
         $advantage_shop = $user->shop->advantages()->lists('advantage_id')->toArray();
     } else {
         $advantage_shop = [];
     }
     return view('profile.index', compact('info', 'provinces', 'cities', 'location', 'user', 'advantages', 'advantage_shop', 'shop'))->with(['title' => $user->first_name]);
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(UserRequest $request, User $user)
 {
     /*  New User Table */
     $user->name = $request['Fname'];
     $user->surname = $request['Sname'];
     $user->cellphone = $request['Cell1'];
     $user->username = $request['Email'];
     $user->email = $request['Cell1'];
     $position = Position::where('slug', '=', $request['Position'])->first();
     $user->position = $position->id;
     $province = Province::where('slug', '=', $request['Province'])->first();
     $user->province = $province->id;
     $district = District::where('slug', '=', $request['District'])->first();
     $user->district = $district->id;
     $municipalityIds = array();
     foreach ($request['Municipality'] as $municipalityName) {
         $municipality = Municipality::where('slug', '=', $municipalityName)->first();
         $municipalityIds[] = $municipality->id;
     }
     $user->municipality = implode(",", $municipalityIds);
     $department = Department::where('slug', '=', $request['Department'])->first();
     $user->department = $department->id;
     $password = rand(1000, 99999);
     $user->password = \Hash::make($password);
     $user->api_key = uniqid();
     $user->status = 1;
     $user->role = 2;
     $user->save();
     \Session::flash('success', $request['Fname'] . ' ' . $request['Sname'] . ' has been added successfully!');
     $data = array('name' => $user->name, 'username' => $user->email, 'password' => $password);
     \Mail::send('emails.registrationConfirmation', $data, function ($message) use($user) {
         $message->from('*****@*****.**', 'Siyaleader');
         $message->to($user->username)->subject("Siyaleader User Registration Confirmation: " . $user->name);
     });
     return redirect('list-users');
 }
Example #9
0
 public function search(Request $request)
 {
     //fill the select boxes
     $provinces = Province::where('parent_id', null)->lists('name', 'id');
     $provinces[0] = 'اهمیتی ندارد';
     $cities = Province::where('parent_id', null)->firstOrFail()->getDescendants()->lists('name', 'id');
     $cities[0] = 'اهمیتی ندارد';
     $firstSkillCat = Category::where('parent_id', null)->lists('name', 'id');
     $firstSkillCat[0] = 'اهمیتی ندارد';
     $secondSkillCat = Category::where('parent_id', null)->firstOrFail()->getDescendants()->lists('name', 'id');
     $secondSkillCat[0] = 'اهمیتی ندارد';
     $catSelected = $request->input('view_d');
     $productCat = Category::where('depth', 1)->lists('name', 'id');
     $productCat[0] = 'اهمیتی ندارد';
     $user = $this->binding($request);
     if ($request->input('view_d') == 'users') {
         $results = $this->userProccess($request);
     } elseif ($request->input('view_d') == 'products') {
         $results = $this->productProccess($request);
     }
     return view('search.index', compact('user', 'results'))->with(['title' => 'نتایج جستجو', 'catSelected' => $catSelected, 'provinces' => $provinces, 'cities' => $cities, 'firstSkillCat' => $firstSkillCat, 'secondSkillCat' => $secondSkillCat, 'productCat' => $productCat]);
 }
Example #10
0
 public function scheduleInfo(Skill $skill)
 {
     $schedules = $skill->schedules()->get();
     $scheduleRepository = new ScheduleRepository();
     $amountRepository = new AmountRepository();
     $serviceRepository = new ServiceRepository();
     $amount_types = $amountRepository->type();
     $amount_per_units = $amountRepository->per_units();
     $amount_units = $amountRepository->units();
     $week_days = $scheduleRepository->week_days();
     $services_list = $serviceRepository->all();
     $amounts = $skill->amounts()->get();
     $areas = $skill->areas()->get();
     $galleries = $skill->galleries()->get();
     $services = $skill->services()->get();
     $provinces = Province::where('parent_id', null)->lists('name', 'id');
     $cities = Province::where('parent_id', null)->firstOrFail()->getDescendants()->lists('name', 'id');
     return view('profile.newSkill', compact('skill', 'schedules', 'week_days', 'amounts', 'amount_types', 'amount_per_units', 'amount_units', 'areas', 'provinces', 'galleries', 'cities', 'services', 'services_list'))->with(['title' => 'ثبت مهارت جدید', 'new_skill' => 0, 'edit_skill' => 1, 'step' => 3, 'hasEdit' => 1]);
 }
Example #11
0
Route::get('reports', ['middleware' => 'auth', function () {
    return view('reports.list');
}]);
Route::get('reports-list', ['middleware' => 'auth', 'uses' => 'ReportsController@index']);
Route::post('filterReports', ['middleware' => 'auth', 'uses' => 'ReportsController@show']);
/*
|--------------------------------------------------------------------------
| END REPORTS ROUTING
|--------------------------------------------------------------------------
|
*/
$router->resource('users', 'UserController');
Route::get('/api/dropdown/{to}/{from}', function ($to, $from) {
    $name = Input::get('option');
    if ($from == 'province') {
        $object = Province::where('slug', '=', $name)->first();
    }
    if ($from == 'district') {
        $object = District::where('slug', '=', $name)->first();
    }
    if ($from == 'municipality') {
        $object = Municipality::where('slug', '=', $name)->first();
    }
    $listing = DB::table($to)->where($from, $object->id)->lists('name', 'slug');
    return $listing;
});
Route::get('/api/dropdownDepartment/{to}/{from}', function ($to, $from) {
    $name = Input::get('option');
    if ($from == 'department') {
        $object = Department::where('slug', '=', $name)->first();
        $listing = DB::table('categories')->where('department', '=', $object->id)->lists('name', 'slug');
    /**
     * PROJECT_TYPE vs PROVINCE
     */
    public function project_type_province($project_type_key, $province_key, Request $request)
    {
        $province = Province::findByKey($province_key)->first();
        $districts = District::where('province_id', $province->id)->where('is_publish', 1)->orderBy('priority')->orderBy('created_at', 'desc')->get();
        $limit = Config::findByKey('rows_per_page_project')->first()->value;
        $project_type = Project_type::findByKey($project_type_key)->first();
        if (is_null($project_type)) {
            $project_type = Project_type::where('active', 1)->orderBy('priority')->orderBy('created_at', 'desc')->first();
        }
        if (is_null($province)) {
            $province = Province::where('is_publish', 1)->orderBy('priority')->orderBy('created_at', 'desc')->first();
        }
        $projects = Project::where('project_type_id', $project_type->id)->where('province_id', $province->id)->where('active', 1);
        $projects = $projects->orderBy('priority')->orderBy('created_at', 'desc')->paginate($limit);
        $searchDescription = $project_type->name . ' ' . $province->name;
        $link = route('project_type_province', ['project_type_key' => $project_type->key, 'province_key' => $province->key]);
        $breadcrumb = '<ul class="breadcrumb"> 
		<li class="active"><a href="' . route('homepage') . '">Trang chủ</a></li> 
		<li class="active"><a href="' . route('projects') . '">Dự án</a></li> 
		<li class="active"><a href="' . route('project_type', ['project_type_key' => $project_type->key]) . '">' . $project_type->name . '</a></li> 
		<li class=""><a href="' . $link . '">' . $province->name . '</a></li> 
		</ul>';
        $heading = $project_type->name . ' ' . $province->name;
        $this->setMetadata($searchDescription);
        return view('frontend.sites1.project_search', ['projects' => $projects, 'project_type' => $project_type, 'province' => $province, 'districts' => $districts, 'search_type' => 'project_type_province', 'link' => $link, 'searchDescription' => $searchDescription, 'breadcrumb' => $breadcrumb, 'heading' => $heading]);
    }
Example #13
0
 public function googleCoordsPage()
 {
     $provinces = Province::where('id', '=', 1)->orderBy('id')->get();
     return view('google_coords', compact('provinces'));
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  int  $id
  * @return Response
  */
 public function captureCaseUpdate(CaseRequest $request)
 {
     $houseHolderId = $request['hseHolderId'];
     $userRole = UserRole::where('name', '=', 'House Holder')->first();
     if ($houseHolderId < 1) {
         $user = new User();
         $user->role = $userRole->id;
         $user->name = $request['name'];
         $user->surname = $request['surname'];
         $user->cellphone = $request['cellphone'];
         $user->id_number = $request['id_number'];
         $user->position = $request['position'];
         $user->title = $request['title'];
         $user->house_number = $request['house_number'];
         $user->email = $request['cellphone'] . "@siyaleader.net";
         $user->created_by = \Auth::user()->id;
         $language = Language::where('slug', '=', $request['language'])->first();
         $user->language = $language->id;
         $province = Province::where('slug', '=', $request['province'])->first();
         $user->province = $province->id;
         $district = District::where('slug', '=', $request['district'])->first();
         $user->district = $district->id;
         $municipality = Municipality::where('slug', '=', $request['municipality'])->first();
         $user->municipality = $municipality->id;
         $ward = Ward::where('slug', '=', $request['ward'])->first();
         $user->ward = $ward->id;
         $user->save();
     }
     $casePriority = CasePriority::where('slug', '=', $request['priority'])->first();
     $case = CaseReport::find($request['caseID']);
     $case->description = $request['description'];
     $case->priority = $casePriority->id;
     $case->updated_by = \Auth::user()->id;
     $case->updated_at = \Carbon\Carbon::now('Africa/Johannesburg')->toDateTimeString();
     $case->save();
     return 'ok';
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  int  $id
  * @return Response
  */
 public function update(UpdateUserRequest $request)
 {
     $user = User::where('id', $request['userID'])->first();
     $role = UserRole::where('slug', '=', $request['role'])->first();
     $user->role = $role->id;
     $title = Title::where('slug', '=', $request['title'])->first();
     $user->title = $title->id;
     $user->name = $request['name'];
     $user->surname = $request['area'];
     $user->id_number = $request['id_number'];
     $user->alt_cellphone = $request['alt_cellphone'];
     $user->alt_email = $request['alt_email'];
     $province = Province::where('slug', '=', $request['province'])->first();
     $user->province = $province->id;
     $district = District::where('slug', '=', $request['district'])->first();
     $user->district = $district->id;
     $municipality = Municipality::where('slug', '=', $request['municipality'])->first();
     $user->municipality = $municipality->id;
     $ward = Ward::where('slug', '=', $request['ward'])->first();
     $user->ward = $ward->id;
     $user->area = $request['area'];
     $user->updated_by = \Auth::user()->id;
     $user->updated_at = \Carbon\Carbon::now('Africa/Johannesburg')->toDateTimeString();
     $user->save();
     \Session::flash('success', 'well done! User ' . $request['name'] . ' has been successfully updated!');
     return redirect()->back();
 }
 public function getAuthenticatedUser()
 {
     try {
         if (!($user = JWTAuth::parseToken()->authenticate())) {
             return response()->json(['user_not_found'], 404);
         }
     } catch (Tymon\JWTAuth\Exceptions\TokenExpiredException $e) {
         return response()->json(['token_expired'], $e->getStatusCode());
     } catch (Tymon\JWTAuth\Exceptions\TokenInvalidException $e) {
         return response()->json(['token_invalid'], $e->getStatusCode());
     } catch (Tymon\JWTAuth\Exceptions\JWTException $e) {
         return response()->json(['token_absent'], $e->getStatusCode());
     }
     $user['provname'] = Province::where('provcode', '=', $user['provcode'])->get(array('provname'));
     $user['cityname'] = Municipality::where('citycode', '=', $user['citycode'])->get(array('city_name'));
     $user['provname'] = $user['provname'][0]['provname'];
     $user['cityname'] = $user['cityname'][0]['city_name'];
     // the token is valid and we have found the user via the sub claim
     return response()->json(compact('user'));
 }
Example #17
0
 public function provinceEdit($province_edit)
 {
     $provinces = Province::where(['parent_id' => null])->get();
     return view('admin.setting.provinces', compact('provinces', 'province_edit'))->with(['title' => 'Province List/Add New/Edit', 'hasEdit' => 1]);
 }
Example #18
0
	public static function getProvinceByCountry($country_id)
	{
		$arr_provinces = Province::where('country_id',$country_id)->get()->toArray();
		return $arr_provinces;
	}
 /**
  * get the all provinces
  *
  * @param Request $request
  * @return \Illuminate\Support\Collection
  */
 public function provinces(Request $request)
 {
     return Province::where('province', 'like', "{$request->input('query')}%")->get();
 }
Example #20
0
 /**
  * 获取所有省份
  * @method getProvinces
  * @return [type]       [description]
  */
 public function getProvinces()
 {
     $data = \App\Province::where('pid', '>', 0)->get();
     return $data;
 }