本文整理汇总了PHP中Admin::all方法的典型用法代码示例。如果您正苦于以下问题:PHP Admin::all方法的具体用法?PHP Admin::all怎么用?PHP Admin::all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Admin
的用法示例。
在下文中一共展示了Admin::all方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* Display a listing of admins
*
* @return Response
*/
public function index()
{
// $admins = DB::table('admins')->get();
// $admins =
// [
// 'admins' => $admins
// ];
// return View::make('admins.index', $admins)->withTitle('Admin');
$admins = Admin::all();
return View::make('admins.index', compact('admins'))->withTitle('Admin');
}
示例2: login
public function login()
{
if (Input::exists("email") || Input::exists("password") || Input::exists("key")) {
$key = Input::get("key");
if (!empty($key) && $key == $_SESSION['key']) {
$email = Input::get("email");
$pass = Input::get("password");
if (empty($email) || empty($pass)) {
textMsg("Unable to login as administrator", "error");
Redirect::url("home");
exit;
} else {
$admin = Admin::all(['email' => $email]);
if (count($admin) > 0) {
if (Pass::verify($admin[0]->password, $pass)) {
$_SESSION['adminId'] = $admin[0]->id;
$_SESSION['adminEmail'] = $admin[0]->email;
textMsg("You have logged in", "success");
Redirect::url("administrator/dashboard");
exit;
} else {
textMsg("Password id did not match", "error");
Redirect::url("administrator");
exit;
}
} else {
textMsg("Email id did not match", "error");
Redirect::url("administrator");
exit;
}
}
} else {
textMsg("Unable to login as administrator", "error");
Redirect::url("home");
exit;
}
} else {
textMsg("somethis went wrong try again", "error");
Redirect::url("home");
exit;
}
}
示例3: index
public function index()
{
$this->data['administradores'] = Admin::all();
return View::make('admin/dashboard', $this->data);
}
示例4: dataTables
public function dataTables()
{
$admins = Admin::all();
return Datatable::collection($admins)->showColumns("id", "account", "name", "created_at")->searchColumns('account')->orderColumns('created_at')->setAliasMapping()->make();
}
示例5: add_admin_do
public function add_admin_do()
{
$username = Input::get('username');
$password = Input::get('password');
$validator = Validator::make(array('username' => $username, 'password' => $password), array('username' => 'required', 'password' => 'required|min:6'));
if ($validator->fails()) {
$error_messages = $validator->messages()->first();
Session::put('msg', $error_messages);
$admin = Admin::all();
return View::make('add_admin')->with('title', 'Add Admin')->with('page', 'add_admin')->with('admin', $admin);
} else {
$admin = new Admin();
$password = Hash::make(Input::get('password'));
$admin->username = $username;
$admin->password = $admin->password = $password;
$admin->save();
return Redirect::to("/admin/admins?success=1");
}
}
示例6: logincheck
<?php
/**
* Created by Tyfix 2015
*/
include 'config.php';
logincheck();
$message = [];
if (isset($_GET['delete'])) {
if ($_GET['delete'] == 1) {
$message['type'] = "error";
$message['message'] = "You cannot remove the main admin account";
} else {
$admin = Admin::find($_GET['delete']);
$admin->delete();
$message['type'] = "success";
$message['message'] = "Admin deleted";
}
}
$admins = Admin::all();
echo $template->view()->make('admins')->with('admins', $admins)->with('message', $message)->render();