/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $admin = Apartment::find(Auth::user()->profile->defaultApartment); $usertype = $admin->profile->contains(Auth::user()->profile->id); if ($usertype == true) { $lists = Apartment::find(Auth::user()->profile->defaultApartment)->profiles()->approved()->paginate(12); return view('crm.index', compact('lists')); } elseif ($usertype == false) { $lists = Transaction::where('payer_id', '=', Auth::user()->profile->id)->get(); return view('crm.profileshow', compact('lists')); } }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Apartment::find(); // add conditions that should always apply here $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['date' => SORT_DESC]], 'pagination' => ['pageSize' => 150]]); $this->author_id = Yii::$app->user->isGuest ? 0 : \Yii::$app->user->id; $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails $query->where('0=1'); return $dataProvider; } // grid filtering conditions $query->andFilterWhere(['in', 'id', $this->id])->andFilterWhere(['in', 'title', $this->title])->andFilterWhere(['in', 'description', $this->description])->andFilterWhere(['in', 'price', $this->price])->andFilterWhere(['in', 'address', $this->address])->andFilterWhere(['in', 'show_on_map', $this->show_on_map])->andFilterWhere(['in', 'html', $this->html])->andFilterWhere(['in', 'query_id', $this->query_id])->andFilterWhere(['in', 'author_id', $this->author_id])->andFilterWhere(['in', 'updater_id', $this->updater_id])->andFilterWhere(['in', 'created_at', $this->created_at])->andFilterWhere(['in', 'like', $this->like])->andFilterWhere(['in', 'updated_at', $this->updated_at]); return $dataProvider; }
/** * Display the specified resource. * * @param int $id * @return Response */ public function show($id) { $poll = Poll::with('options')->find($id); $profile = Profile::find(Auth::user()->profile->id); if ($poll->profile->contains($profile->id)) { $profiles = Apartment::find(Auth::user()->profile->defaultApartment)->profiles()->approved()->get(); $stats = DB::table('profile_poll')->wherePollId($id)->groupBy('option_id')->get([DB::raw('option_id as option'), DB::raw('count(option_id) as option_count')]); if (count($stats) > 0) { foreach ($stats as $list) { $option[] = Option::find($list->option)->option; $option_count[] = intval($list->option_count); } } else { $option[] = 'No Polling held yet'; $option_count[] = '0'; } $title = $poll->title; return view('polls.result', compact('profiles', 'title', 'stats', 'poll', 'option', 'option_count')); } else { $list = Poll::with('options')->find($id); return view('polls.show', compact('list')); } }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $profiles = Apartment::find(Auth::user()->profile->defaultApartment)->profiles()->approved()->get(); $requestBy = Apartment::find(Auth::user()->profile->defaultApartment)->profiles()->notapproved()->get(); return view('apartmentadmin.index', compact('profiles', 'requestBy')); }
/** * Display a listing of the resource. * Shows list of banks associated with default Apartment. * * @return \Illuminate\Http\Response */ public function index() { $da = Auth::user()->profile->defaultApartment; $banks = Apartment::find($da)->bank()->get(); return view('bank.index', compact('banks')); }
/** * @param Request $request * @return mixed */ public function storeApartmentUserInfo(Request $request) { $apartment = Apartment::find(32); $profile = Auth::user()->profile; $block_no = $request->input('blockno'); // get block_no from profileform $floor_no = $request->input('floorno'); // get floor_no from profileform $profile->apartments()->detach($apartment); $profile->apartments()->attach($apartment, ['approved' => '1', 'block_no' => $block_no, 'floor_no' => $floor_no]); return redirect()->back()->withMessage('Block / Flat Number Updated')->withStatus('success'); }
public function getCountAllNew() { return Apartment::find()->where(['author_id' => \Yii::$app->user->id])->andFilterWhere(['in', 'query_id', $this->id])->andFilterWhere(['less', 'date', date('yesterday')])->count(); }
public function getAddRequest() { $requestBy = Apartment::find(LAuth::user()->profile->defaultApartment)->profiles()->notapproved()->get(); return $requestBy; }
function parseHtml($url, $query_id) { $html = SHD::file_get_html($url); $count = 0; foreach ($html->find('#offers_table', 0)->find('.offer') as $element) { try { $link = $element->find(".link", 0); $price = $element->find(".price", 0); $image = $element->find("img", 0); $breadcrumb = $element->find('.breadcrumb span', 0); $date = $element->find('td[valign=bottom] p.x-normal', 0); if (isset($link->href)) { $ap = Apartment::find()->where(['url' => $link->href])->one(); if (!$ap) { $count++; $apartment = new Apartment(); $apartment->url = $link->href; $apartment->title = trim($link->plaintext); $apartment->address = trim($breadcrumb->plaintext); $apartment->price = filter_var($price->plaintext, FILTER_SANITIZE_NUMBER_INT); $apartment->currency = trim(preg_replace('/\\d+/u', '', $price->plaintext)); $apartment->query_id = $query_id; $apartment->date = $this->parseDate(trim($date->plaintext)); if ($image) { $apartment->image_link = $image->src; } $apartment->save(); } elseif (!Apartment::find()->where(['url' => $link->href])->andWhere(['query_id' => $query_id])->one()) { $count++; $apartment = clone $ap; $apartment->query_id = $query_id; $apartment->save(); } } } catch (\Exception $e) { continue; } } return $count; }