本文整理汇总了PHP中Admin::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Admin::where方法的具体用法?PHP Admin::where怎么用?PHP Admin::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Admin
的用法示例。
在下文中一共展示了Admin::where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createParent
public function createParent()
{
$input = Input::all();
if (Input::hasFile('profilepic')) {
$input['profilepic'] = $this->filestore(Input::file('profilepic'));
}
$input['dob'] = date('Y-m-d H:i:s', strtotime(Input::get('dob')));
$input['collegeid'] = Session::get('user')->collegeid;
$input['collegename'] = Admin::where('collegeid', '=', Session::get('user')->collegeid)->first()->collegename;
//$input['collegeid']="dummy";
//$input['collegename']="dummy";
$user = new User();
$user->email = $input['email'];
$user->password = Hash::make($input['password']);
$user->collegeid = $input['collegeid'];
$user->flag = 3;
$user->save();
$input['loginid'] = $user->id;
$removed = array('_token', 'password', 'cpassword');
foreach ($removed as $k) {
unset($input[$k]);
}
Parent::saveFormData($input);
return $input;
}
示例2: login
/**
* [login 登录]
* @return [type] [description]
*/
public function login()
{
if (IS_POST) {
if (strtoupper(I('post.code')) != strtoupper(myRedis::get('code'))) {
View::error('验证码错误!', 'http://' . __HOST__ . '/admin/login/');
die;
}
$userName = I('post.username');
$password = I('post.password');
$pwd = md5('ISirweb' . $password);
$userData = Admin::where(['who' => $userName, 'mypwd' => $pwd])->get()->toArray();
if (empty($userData)) {
View::error('用户名或密码错误!', 'http://' . __HOST__ . '/admin/login/');
die;
}
//如果未修改php.ini下面两行注释去掉
// ini_set('session.save_handler', 'redis');
// ini_set('session.save_path', 'tcp://127.0.0.1:6379');
session_start();
$_SESSION['uid'] = $userData[0]['id'];
$_SESSION['name'] = $userData[0]['who'];
$_SESSION['email'] = $userData[0]['email'];
View::success('登录成功', 'http://' . __HOST__ . '/admin/');
die;
}
$this->smarty->assign('title', '登录_ISisWeb中文网_ISirPHPFramework');
$this->smarty->display('Admin/Login/login.html');
die;
}
示例3: createStudent
public function createStudent()
{
$validator = $this->validateStudent(Input::all());
if ($validator->fails()) {
$messages = $validator->messages();
return Redirect::to('student-new')->withErrors($messages)->withInput(Input::except('password', 'password_confirmation'));
}
$input = Input::all();
//$input['dob'] = date('m-d-Y H:i:s', strtotime(Input::get('dob')));
$input['collegename'] = Admin::where('collegeid', '=', Session::get('user')->collegeid)->first()->collegename;
$input['collegeid'] = Session::get('user')->collegeid;
//$input['collegeid']="dummy";
//$input['collegename']="dummy";
$user = new User();
$user->email = $input['email'];
$user->password = Hash::make($input['password']);
$user->collegeid = $input['collegeid'];
$user->flag = 3;
$user->save();
$input['loginid'] = $user->id;
if (Input::hasFile('profilepic')) {
$input['profilepic'] = $this->filestore(Input::file('profilepic'), $user->id);
}
$removed = array('password', 'password_confirmation');
foreach ($removed as $k) {
unset($input[$k]);
}
Student::saveFormData($input);
return Redirect::to('student');
}
示例4: verify
public function verify()
{
$username = Input::get('username');
$password = Input::get('password');
if (Admin::count() == 0) {
$admin = new Admin();
$admin->username = $username;
$admin->name = $username;
$admin->designation = 'Admin';
$admin->image_url = '';
$admin->password = Hash::make($password);
$admin->remember_token = '';
$admin->save();
return Redirect::to('admin/login');
}
$admin = Admin::where('username', $username)->first();
if ($admin && Hash::check($password, $admin->password)) {
Session::put('admin_id', $admin->id);
Session::put('admin_username', $admin->username);
Session::put('admin_name', $admin->name);
Session::put('admin_image_url', $admin->image_url);
Session::put('admin_designation', $admin->designation);
return Redirect::to('admin/dashboard');
} else {
$message = "Invalid Username and Password";
$type = "failed";
return Redirect::to('/admin/login')->with('type', $type)->with('message', $message);
}
}
示例5: destroy
public function destroy($id)
{
Admin::where('id', '=', $id)->delete();
Activity::log(['contentId' => $id, 'user_id' => Auth::admin()->get()->id, 'contentType' => 'Administrador', 'action' => 'Delete ', 'description' => 'Eliminacion de un administrador', 'details' => 'Usuario: ' . Auth::admin()->get()->name, 'updated' => $id ? true : false]);
$output['success'] = 'deleted';
return Response::json($output, 200);
}
示例6: exportmahasiswalogbook
private function exportmahasiswalogbook($mlogbooks)
{
$akun = Admin::where('user_id', Sentry::getUser()->id)->first();
$name = 'Log_book_Atletik_' . Date('Y') . '_' . $akun->noi . '_' . $akun->name . '.pdf';
$data['datas'] = $mlogbooks;
$pdf = PDF::loadView('logs.laporan', $data)->setPaper('a4')->setOrientation('landscape');
return $pdf->download($name);
}
示例7: postDeleteAdmin
public function postDeleteAdmin()
{
$admin_id = Input::get('Admin_ID');
$admin = Admin::where('id', '=', $admin_id)->first();
$admin->Active = FALSE;
if ($admin->save()) {
return Redirect::route('super-admin-view-admins-get')->with('globalsuccess', 'Admin details have been deleted');
}
}
开发者ID:franqq,项目名称:Secure-Evoting-With-Face-Recognition,代码行数:9,代码来源:SuperAdminNavigationController.php
示例8: isValidAdmin
public function isValidAdmin()
{
$username = Input::get('username');
$password = Input::get('password');
$admin = Admin::where('username', '=', $username)->where('password', '=', $password)->first();
if (is_null($admin)) {
return json_encode(array('message' => 'wrong'));
} else {
Session::put('admin_id', $admin->id);
Session::put('user_type', 'Administrator');
Session::put('name', $admin->name);
return json_encode(array('message' => 'correct'));
}
}
示例9: searchUserOperation
public static function searchUserOperation($input)
{
$users = Admin::where(function ($query) use($input) {
if ($input['role_id']) {
$query = $query->where('role_id', $input['role_id']);
}
if ($input['keyword']) {
$query = $query->where('email', 'like', '%' . $input['keyword'] . '%')->orWhere('username', 'like', '%' . $input['keyword'] . '%');
}
// todo
// if ($input['start_date'])
// $query = $query->where('updated_at', '>=' ,$input['start_date']);
// if ($input['end_date'])
// $query = $query->where('updated_at', '<=' ,$input['end_date'].' 23:59:59');
})->orderBy('id', 'desc')->paginate(PAGINATE);
return $users;
}
示例10: login
public function login($username, $password)
{
return Admin::where('username', $username)->where('password', md5($password))->first();
}
示例11: header
<?php
echo '<div align="right"><H1><a href="lang/choose-lang.php"> Language </a></H1></div>';
include 'lang/lang.php';
include 'config.php';
if (isset($_SESSION['user_id'])) {
header("location: dashboard.php");
}
$error = '';
if (isset($_POST['submit'])) {
if (empty($_POST['username']) || empty($_POST['password'])) {
$error = TXT_USERNAME_PASSWOR_INVALID;
} else {
$username = stripslashes($_POST['username']);
$password = stripslashes($_POST['password']);
$userfind = Admin::where('username', '=', $username)->where('password', '=', md5($password))->count();
if ($userfind > 0) {
$_SESSION['user_id'] = $username;
header("location: dashboard.php");
} else {
$error = TXT_USERNAME_PASSWOR_INVALID;
}
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title><?php
echo TXT_FOS_STREAMING_CONTROL_PANEL;
示例12: logincheck
logincheck();
$message = [];
$title = "Create admin";
$admin = new Admin();
if (isset($_GET['id'])) {
$title = "Edit admin";
$admin = Admin::where('id', '=', $_GET['id'])->first();
}
if (isset($_POST['submit'])) {
$admin->username = $_POST['username'];
if ($_POST['password'] != "") {
$admin->password = md5($_POST['password']);
}
if (isset($_GET['id'])) {
$message['type'] = "success";
$message['message'] = "admin edited";
$admin->save();
} else {
$exists = Admin::where('username', '=', $_POST['username'])->get();
if (count($exists) > 0) {
$message['type'] = "error";
$message['message'] = "admin name already exists";
} else {
$message['type'] = "success";
$message['message'] = "admin Created";
$admin->save();
redirect("manage_admin.php?id=" . $admin->id, 2000);
}
}
}
echo $template->view()->make('manage_admin')->with('admin', $admin)->with('message', $message)->with('title', $title)->render();
示例13:
if (lat != '') {
latitude = lat;
longitude = lng;
} else {
var mapOptions = {
zoom: 6
};
map = new google.maps.Map(document.getElementById('map'),
mapOptions);
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function (position) {
<?php
if (Session::has('admin_id')) {
$id = Session::get('admin_id');
$admin = Admin::where('id', $id)->first();
}
$latitude = 0;
$longitude = 0;
if (isset($admin)) {
$latitude = $admin->latitude;
$longitude = $admin->longitude;
}
?>
<?php
if ($latitude != 0 && $longitude != 0) {
?>
var pos = new google.maps.LatLng("<?php
echo $latitude;
?>
示例14: verify
public function verify()
{
$username = Input::get('username');
$password = Input::get('password');
if (!Admin::count()) {
$user = new Admin();
$user->username = Input::get('username');
$user->password = $user->password = Hash::make(Input::get('password'));
$user->save();
return Redirect::to('/admin/login');
} else {
if (Auth::attempt(array('username' => $username, 'password' => $password))) {
if (Session::has('pre_admin_login_url')) {
$url = Session::get('pre_admin_login_url');
Session::forget('pre_admin_login_url');
return Redirect::to($url);
} else {
$admin = Admin::where('username', 'like', '%' . $username . '%')->first();
Session::put('admin_id', $admin->id);
return Redirect::to('/admin/report')->with('notify', 'installation Notification');
}
} else {
return Redirect::to('/admin/login?error=1');
}
}
}
示例15: function
<?php
Validator::extend('unique_delete', function ($attribute, $value, $parameters) {
if (Admin::where('username', $value)->first()) {
return false;
}
return true;
});