本文整理汇总了PHP中app\models\Usuario::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Usuario::find方法的具体用法?PHP Usuario::find怎么用?PHP Usuario::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Usuario
的用法示例。
在下文中一共展示了Usuario::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: destroy
public function destroy($id)
{
$usuarios = Usuario::find($id);
$usuarios->delete();
Session::flash('message', 'El usuario ' . $usuarios->nombres . ' de rut ' . $usuarios->rut . ' fue eliminado');
return redirect()->route('Administrador.usuarios.index');
}
示例2: usuario_existe
public function usuario_existe($attribute, $params)
{
$table = Usuario::find()->where("nombre_usuario=:nom", [":nom" => $this->nombre_usuario]);
if ($table->count() != 0) {
$this->addError($attribute, "El nobre de usuario seleccionado existe");
}
}
示例3: findByUsername
/**
* Finds user by username
*
* @param string $username
* @return static|null
*/
public static function findByUsername($username)
{
$dbUser = DbUser::find()->where(["username" => $username])->one();
if (!count($dbUser)) {
return null;
}
return new static($dbUser);
}
示例4: __construct
public function __construct(Factory $factory)
{
//Custom Validator Rut
$factory->extend('old_password', function ($attribute, $value, $parameters) {
$id = $this->id;
$usuario = Usuario::find($id);
return Hash::check($value, $usuario->password);
}, 'La Constraseña actual no corresponde');
$factory->extend('rut_valid', function ($attribute, $value, $parameters) {
return Rut::check($value);
}, 'El campo Rut no tiene un formato válido');
}
示例5: showconversations
/**
* Display all conversations
*
* @return data array json
*/
public function showconversations()
{
//$results = DB::select('select * from conversations where user1_id = ?', dataay($input['user1_id']));
$conversations = Conversation::where('user1_id', Input::get('user1_id'))->orderBy('updated_at', 'DESC')->get();
foreach ($conversations as $conversation) {
//Se rellenan las imagenes de usuario en la lista de conversaciones
$id = $conversation->user2_id;
//ID del usuario a buscar
$imagen = Usuario::find($id)->imagen;
$conversation['imagen'] = $imagen;
}
return json_encode($conversations);
}
示例6: search
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = Usuario::find();
$dataProvider = new ActiveDataProvider(['query' => $query]);
$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;
}
$query->andFilterWhere(['idUsuario' => $this->idUsuario, 'nome' => $this->nome, 'email' => $this->email, 'telefone' => $this->telefone, 'data_criacao' => $this->data_criacao]);
return $dataProvider;
}
示例7: search
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = Usuario::find();
$dataProvider = new ActiveDataProvider(['query' => $query]);
$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;
}
$query->andFilterWhere(['id' => $this->id, 'id_persona' => $this->id_persona]);
$query->andFilterWhere(['like', 'usuario', $this->usuario])->andFilterWhere(['like', 'contrasenha', $this->contrasenha]);
return $dataProvider;
}
示例8: search
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = Usuario::find();
$dataProvider = new ActiveDataProvider(['query' => $query]);
$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;
}
$query->andFilterWhere(['usua_codigo' => $this->usua_codigo, 'usua_habilitado' => $this->usua_habilitado, 'usua_data_criacao' => $this->usua_data_criacao, 'usua_data_alteracao' => $this->usua_data_alteracao]);
$query->andFilterWhere(['like', 'usua_nome', $this->usua_nome])->andFilterWhere(['like', 'usua_email', $this->usua_email])->andFilterWhere(['like', 'usua_senha', $this->usua_senha])->andFilterWhere(['like', 'usua_auth_key', $this->usua_auth_key]);
return $dataProvider;
}
示例9: search
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = Usuario::find();
$dataProvider = new ActiveDataProvider(['query' => $query]);
$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;
}
$query->andFilterWhere(['id' => $this->id, 'activate' => $this->activate]);
$query->andFilterWhere(['like', 'username', $this->username])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'lastname', $this->lastname])->andFilterWhere(['like', 'role', $this->role])->andFilterWhere(['like', 'password', $this->password])->andFilterWhere(['like', 'authKey', $this->authKey])->andFilterWhere(['like', 'accessToken', $this->accessToken]);
return $dataProvider;
}
示例10: search
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = Usuario::find();
$dataProvider = new ActiveDataProvider(['query' => $query]);
$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;
}
$query->andFilterWhere(['Id_Grupo' => $this->Id_Grupo, 'Id' => $this->Id, 'Id_Empleado' => $this->Id_Empleado, 'Eliminado' => $this->Eliminado]);
$query->andFilterWhere(['like', 'Cuenta', $this->Cuenta])->andFilterWhere(['like', 'Contrasena', $this->Contrasena]);
return $dataProvider;
}
示例11: search
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = Usuario::find();
$dataProvider = new ActiveDataProvider(['query' => $query]);
$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;
}
$query->andFilterWhere(['id' => $this->id]);
$query->andFilterWhere(['like', 'login', $this->login])->andFilterWhere(['like', 'senha', $this->senha])->andFilterWhere(['like', 'nome', $this->nome])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'pagina', $this->pagina]);
return $dataProvider;
}
示例12: search
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = Usuario::find();
$dataProvider = new ActiveDataProvider(['query' => $query]);
$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;
}
$query->andFilterWhere(['idusuario' => $this->idusuario]);
$query->andFilterWhere(['like', 'nombre', $this->nombre])->andFilterWhere(['like', 'edad', $this->edad])->andFilterWhere(['like', 'sexo', $this->sexo])->andFilterWhere(['like', 'apellido_pat', $this->apellido_pat])->andFilterWhere(['like', 'apellido_mat', $this->apellido_mat]);
return $dataProvider;
}
示例13: login
public function login()
{
$input = Input::all();
$lembreMe = empty($input['lembre_me']) ? false : true;
if (Auth::attempt(['usuario' => $input['usuario'], 'password' => $input['senha']], $lembreMe)) {
$pessoa = Usuario::find(Auth::user()->id)->first();
session()->put('user_nome', $pessoa->nome);
session()->put('user_email', $pessoa->email);
session()->put('user_usuario', $pessoa->usuario);
session()->put('user_id', $pessoa->id);
return redirect('admin/home');
}
flash()->error('Login', trans('admin.msg_usuario_error'));
return $this->wbd->view('backend.pages.login.index');
}
示例14: show
public function show($id)
{
$usuarios = Usuario::find($id);
//dd($Campus);
if ($usuarios) {
$data = array(array('rut', 'nombres', 'apellidos', 'email'), array($estudiantes->rut, $estudiantes->nombres, $estudiantes->apellidos, $estudiantes->email));
Excel::create('Usuarios' . $usuarios->nombres, function ($excel) use($data) {
$excel->sheet('Sheetname', function ($sheet) use($data) {
$sheet->fromArray($data);
});
})->download('csv');
} else {
abort('404');
}
}
示例15: search
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = Usuario::find();
// add conditions that should always apply here
$dataProvider = new ActiveDataProvider(['query' => $query]);
$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(['id' => $this->id, 'dtEntrada' => $this->dtEntrada, 'isAdmin' => $this->isAdmin, 'isAtivo' => $this->isAtivo]);
$query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'cpf', $this->cpf])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'password', $this->password])->andFilterWhere(['like', 'matricula', $this->matricula])->andFilterWhere(['like', 'siape', $this->siape])->andFilterWhere(['like', 'perfil', $this->perfil])->andFilterWhere(['like', 'auth_key', $this->auth_key])->andFilterWhere(['like', 'password_reset_token', $this->password_reset_token]);
return $dataProvider;
}