/var/www/vhosts/nabawater/vendor/dektrium/yii2-user/models
NameSizeModeActions
query/-0755rm
Account.php62690644editdlrm
LoginForm.php50920644editdlrm
Profile.php48050644editdlrm
RecoveryForm.php36950644editdlrm
RegistrationForm.php37850644editdlrm
ResendForm.php25420644editdlrm
SettingsForm.php64520644editdlrm
Token.php29670644editdlrm
User.php177590644editdlrm
UserSearch.php29660644editdlrm
Edit: /var/www/vhosts/nabawater/vendor/dektrium/yii2-user/models/UserSearch.php (2966B)
* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace dektrium\user\models; use dektrium\user\Finder; use Yii; use yii\base\Model; use yii\data\ActiveDataProvider; /** * UserSearch represents the model behind the search form about User. */ class UserSearch extends Model { /** @var integer */ public $id; /** @var string */ public $username; /** @var string */ public $email; /** @var int */ public $created_at; /** @var int */ public $last_login_at; /** @var string */ public $registration_ip; /** @var Finder */ protected $finder; /** * @param Finder $finder * @param array $config */ public function __construct(Finder $finder, $config = []) { $this->finder = $finder; parent::__construct($config); } /** @inheritdoc */ public function rules() { return [ 'fieldsSafe' => [['id', 'username', 'email', 'registration_ip', 'created_at', 'last_login_at'], 'safe'], 'createdDefault' => ['created_at', 'default', 'value' => null], 'lastloginDefault' => ['last_login_at', 'default', 'value' => null], ]; } /** @inheritdoc */ public function attributeLabels() { return [ 'id' => Yii::t('user', '#'), 'username' => Yii::t('user', 'Username'), 'email' => Yii::t('user', 'Email'), 'created_at' => Yii::t('user', 'Registration time'), 'last_login_at' => Yii::t('user', 'Last login'), 'registration_ip' => Yii::t('user', 'Registration ip'), ]; } /** * @param $params * * @return ActiveDataProvider */ public function search($params) { $query = $this->finder->getUserQuery(); $dataProvider = new ActiveDataProvider([ 'query' => $query, 'sort' => ['defaultOrder' => ['created_at' => SORT_DESC]], ]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $modelClass = $query->modelClass; $table_name = $modelClass::tableName(); if ($this->created_at !== null) { $date = strtotime($this->created_at); $query->andFilterWhere(['between', $table_name . '.created_at', $date, $date + 3600 * 24]); } $query->andFilterWhere(['like', $table_name . '.username', $this->username]) ->andFilterWhere(['like', $table_name . '.email', $this->email]) ->andFilterWhere([$table_name . '.id' => $this->id]) ->andFilterWhere([$table_name . 'registration_ip' => $this->registration_ip]); return $dataProvider; } }