コード例 #1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::statement("SET foreign_key_checks = 0");
     Apartment::truncate();
     Apartment::create(['name' => 'Krushna Apartment', 'address_line1' => 'Yadav Nagar', 'address_line2' => 'Nr. Some Square', 'address_line3' => 'Jaiswal Restaurent', 'city' => 'Nagpur', 'state' => 'Maharashtra', 'country' => 'India', 'pincode' => '440026', 'lat' => '1.000', 'lng' => '2.000']);
     Apartment::create(['name' => 'Ravan Apartment', 'address_line1' => 'Gajanan Nagar', 'address_line2' => 'Nr. Some Square', 'address_line3' => 'Lagoo Restaurent', 'city' => 'Nagpur', 'state' => 'Maharashtra', 'country' => 'India', 'pincode' => '440032', 'lat' => '1.000', 'lng' => '2.000']);
 }
コード例 #2
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $users = User::find($id);
     $apartment = Apartment::findOrFail($users->profile->defaultApartment);
     $prof = $apartment->profiles()->where('profile_id', '=', $users->profile->id)->first();
     // fetches profile_id from pivot table
     return view('apartmentadmin.show', compact('users', 'prof'));
 }
コード例 #3
0
ファイル: CrmController.php プロジェクト: suchayj/easymanage
 /**
  * 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'));
     }
 }
コード例 #4
0
ファイル: ApartmentSearch.php プロジェクト: myorb/alox
 /**
  * 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;
 }
コード例 #5
0
 /**
  * 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'));
     }
 }
コード例 #6
0
ファイル: BankController.php プロジェクト: suchayj/easymanage
 /**
  * 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'));
 }
コード例 #7
0
 /**
  * @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');
 }
コード例 #8
0
ファイル: Like.php プロジェクト: myorb/alox
 public function getApartment()
 {
     return $this->hasOne(Apartment::className(), ['id' => 'apartment_id']);
 }
コード例 #9
0
ファイル: Query.php プロジェクト: myorb/alox
 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();
 }
コード例 #10
0
ファイル: UserController.php プロジェクト: suchayj/easymanage
 public function getAddRequest()
 {
     $requestBy = Apartment::find(LAuth::user()->profile->defaultApartment)->profiles()->notapproved()->get();
     return $requestBy;
 }
コード例 #11
0
ファイル: ApartmentController.php プロジェクト: myorb/alox
 /**
  * Finds the Apartment model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Apartment the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Apartment::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
コード例 #12
0
ファイル: SiteController.php プロジェクト: myorb/alox
 public function actionClear()
 {
     return Apartment::deleteAll();
 }