/** * Lists all Rank models. * @return mixed */ public function actionIndex($id = 0) { if ($id == 0) { $rank = Rank::find()->all(); } else { $rank = Rank::find()->where(['=', 'id_user', $id])->all(); } return $this->render('index', ['rank' => $rank]); }
public function search($params) { $query = Rank::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'value' => $this->value]); $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'traditional_name', $this->traditional_name]); return $dataProvider; }
/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update(InsertPoliceRequest $request, $id) { $user = PoliceImmigration::find($id); $user->fill(Input::except(['password'])); if (Input::get('password')) { // return Input::get('password'); $user->password = Hash::make(Input::get('password')); } if (Input::has('position.id')) { $position = Position::find(Input::get('position.id')); $user->position()->associate($position); } if (Input::has('rank.id')) { $rank = Rank::find(Input::get('rank.id')); $user->rank()->associate($rank); } if (Input::has('role.id')) { $role = Role::find(Input::get('role.id')); $user->role()->associate($role); } $user->save(); return $user; }
public static function getMap() { return ArrayHelper::map(Rank::find()->where(['active' => 1])->orderBy('ord')->all(), 'id', 'name'); }
public static function GetResultados($id) { $modelAposta = Rank::find()->where(['=', 'id_user', $id])->andWhere(['=', 'id_ponto', '2'])->all(); $total = 0; foreach ($modelAposta as $item) { $total = $total + 1; } return $total; }