本文整理汇总了PHP中Admin::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Admin::create方法的具体用法?PHP Admin::create怎么用?PHP Admin::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Admin
的用法示例。
在下文中一共展示了Admin::create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
DB::table('admins')->delete();
Admin::create(array('name' => 'SuperUser', 'username' => 'root', 'password' => Hash::make('pass')));
Admin::create(array('name' => 'RobiTemp', 'username' => 'robi', 'password' => Hash::make('robi')));
Admin::create(array('name' => 'Base Technologies', 'username' => 'base', 'password' => Hash::make('pass')));
}
示例2: postNewAdmin
public function postNewAdmin()
{
//verify the user input and create account
$validator = Validator::make(Input::all(), array('Identity_No' => 'required', 'Email' => 'required|email', 'Phone_Number' => 'required', 'First_Name' => 'required', 'Last_Name' => 'required', 'Photo_1' => 'image|required', 'Photo_2' => 'image|required', 'Photo_3' => 'image|required'));
if ($validator->fails()) {
return Redirect::route('super-admin-new-admin-get')->withErrors($validator)->withInput()->with('globalerror', 'Sorry!! The Data was not Saved, please retry');
} else {
$identitynumber = Input::get('Identity_No');
$email = Input::get('Email');
$phonenumber = Input::get('Phone Numer');
$firstname = Input::get('First_Name');
$lastname = Input::get('Last_Name');
$photo_1 = Input::file('Photo_1');
$photo_2 = Input::file('Photo_2');
$photo_3 = Input::file('Photo_3');
//register the new user
$newuser = User::create(array('Identity_No' => $identitynumber, 'First_Name' => $firstname, 'Last_Name' => $lastname, 'Password' => Hash::make($identitynumber), 'Active' => TRUE));
//register the new user contact
$newcontact = Contact::create(array('Email' => $email, 'Phone_Number' => $phonenumber));
//Save the three Photos
$photo1 = $this->postPhoto($photo_1);
$photo2 = $this->postPhoto($photo_2);
$photo3 = $this->postPhoto($photo_3);
$newphotos = Photo::create(array('photo_1' => $photo1, 'photo_2' => $photo2, 'photo_3' => $photo3));
//save the details to the students table
$newadmin = Admin::create(array('Users_Id' => $newuser->id, 'Contacts_Id' => $newcontact->id, 'Photos_Id' => $newphotos->id));
if ($newuser && $newcontact && $newphotos && $newadmin) {
return Redirect::route('super-admin-new-admin-get')->with('globalsuccess', 'New Admin Details Have been Added');
}
}
}
开发者ID:franqq,项目名称:Secure-Evoting-With-Face-Recognition,代码行数:31,代码来源:SuperAdminNavigationController.php
示例3: create
public function create()
{
if (isset($_POST['name']) && !empty($_POST['name']) && isset($_POST['email']) && !empty($_POST['email']) && isset($_POST['password']) && !empty($_POST['password']) && isset($_POST['rpassword']) && !empty($_POST['rpassword']) && isset($_POST['role']) && !empty($_POST['role'])) {
if ($_POST['rpassword'] == $_POST['password']) {
$admin = new Admin();
$admin->admin_name = $_POST['name'];
$admin->admin_email = $_POST['email'];
$admin->admin_password = hashpassword('md5', $_POST['password'], HASH_PASSWORD_KEY);
$admin->admin_role = $_POST['role'];
if ($admin->create()) {
$_SESSION['adminmessage'] = "Admin created successfully and Saved";
return 1;
} else {
$_SESSION['adminmessage'] = "Password do not match";
return 2;
}
} else {
$_SESSION['adminmessage'] = "Admin not Created, Please try again.";
return 3;
}
} else {
$_SESSION['adminmessage'] = "Please fill the required links.";
return 4;
}
}
示例4: store
/**
* Store a newly created admin in storage.
*
* @return Response
*/
public function store()
{
$validator = Validator::make($data = Input::all(), Admin::$rules);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
}
Admin::create($data);
return Redirect::route('admin.index');
}
示例5: handles_multiple_children_models
/** @test */
public function handles_multiple_children_models()
{
User::create();
Employee::create();
Admin::create();
$users = User::orderBy('type', 'DESC')->get();
$this->assertCount(3, $users);
$this->assertInstanceOf(Employee::class, $users[0]);
$this->assertInstanceOf(Admin::class, $users[1]);
$this->assertInstanceOf(User::class, $users[2]);
}
示例6: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Model::unguard();
// $this->call(UserTableSeeder::class);
DB::table('education')->delete();
Education::create(['edu_id' => '0', 'edu_level' => 'None'], ['edu_id' => '1', 'edu_level' => 'Preschool'], ['edu_id' => '2', 'edu_level' => 'Elementary'], ['edu_id' => '3', 'edu_level' => 'High school'], ['edu_id' => '4', 'edu_level' => 'College']);
DB::table('completed')->delete();
Completed::create(['id_completed' => '0', 'author' => 'Patient'], ['id_completed' => '1', 'author' => 'Caregiver'], ['id_completed' => '2', 'author' => 'Caregiver-assisted']);
DB::table('admin')->delete();
Admin::create(['id_admin' => '0', 'email' => 'admin@mea.com', 'password' => 'pass']);
Model::reguard();
}
示例7: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
$rules = array('username' => 'required|unique:admins,deleted_at,NULL|unique_delete', 'password' => 'required', 'email' => 'required|email|unique:admins,deleted_at,NULL|unique_delete', 'role_id' => 'required');
$input = Input::except('_token');
$validator = Validator::make($input, $rules);
if ($validator->fails()) {
return Redirect::action('ManagerController@create')->withErrors($validator)->withInput(Input::except('password'));
} else {
$input['password'] = Hash::make($input['password']);
$id = Admin::create($input)->id;
if ($id) {
return Redirect::action('ManagerController@index');
} else {
dd('Error');
}
}
}
示例8: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$users = [['f_name' => 'John', 'l_name' => 'Doe', 'email' => 'john@doe.com', 'password' => bcrypt('password'), 'semester_id' => 13, 'department' => 'EEE', 'phone' => '+8801760099824'], ['f_name' => 'Jane', 'l_name' => 'Diana', 'email' => 'jane@diana.com', 'password' => bcrypt('password'), 'semester_id' => 7, 'department' => 'BBS', 'phone' => '+8801760099824'], ['f_name' => 'Martha', 'l_name' => 'Jane', 'email' => 'martha@jane.com', 'password' => bcrypt('password'), 'semester_id' => 10, 'department' => 'ESS', 'phone' => '+8801760099824'], ['f_name' => 'Jeffery', 'l_name' => 'Way', 'email' => 'jeff@way.com', 'password' => bcrypt('password'), 'semester_id' => 9, 'department' => 'SECS', 'phone' => '+8801760099824', 'role' => 'faculty'], ['f_name' => 'Abdur', 'l_name' => 'Rahman', 'email' => 'adnan@bracu.ac.bd', 'password' => bcrypt('password'), 'semester_id' => 5, 'department' => 'SECS', 'phone' => '+8801760099824', 'role' => 'faculty'], ['f_name' => 'Atef', 'l_name' => 'Haque', 'email' => 'atefth@gmail.com', 'password' => bcrypt('password'), 'semester_id' => 15, 'department' => 'EEE', 'phone' => '+8801760099824', 'role' => 'admin']];
$students = [['student_id' => '10101010', 'id' => 1, 'major' => 'EEE'], ['student_id' => '00701020', 'id' => 2, 'major' => 'BBS'], ['student_id' => '10212020', 'id' => 3, 'major' => 'ES']];
$faculties = [['id' => 4, 'faculty_id' => '05603012'], ['id' => 5, 'faculty_id' => '04050205']];
$admins = [['id' => 6, 'admin_id' => '04030204']];
foreach ($users as $key => $user) {
User::create($user);
}
foreach ($students as $key => $student) {
Student::create($student);
}
foreach ($faculties as $key => $faculty) {
Faculty::create($faculty);
}
foreach ($admins as $key => $admin) {
Admin::create($admin);
}
}
示例9: store
public function store()
{
$rules = array('nombreAdmin' => 'required', 'apellidoAdmin' => 'required', 'emailAdmin' => 'required|email', 'passwordAdmin' => 'required');
$validator = Validator::make($input = Input::all(), $rules);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
}
DB::beginTransaction();
try {
$filename = null;
$fullname = $input['nombreAdmin'] . " " . $input['apellidoAdmin'];
Admin::create(['name' => $fullname, 'email' => $input['emailAdmin'], 'password' => Hash::make($input['passwordAdmin'])]);
} catch (\Exception $e) {
DB::rollback();
throw $e;
}
Activity::log(['contentId' => $input['emailAdmin'], 'contentType' => 'Administrador', 'action' => 'Creacion', 'user_id' => Auth::admin()->get()->id, 'description' => 'Creacion del un Administrador', 'details' => 'Usuario: ' . Auth::admin()->get()->name, 'updated' => $input['emailAdmin'] ? true : false]);
DB::commit();
return Redirect::route('admin.dashboard.index')->with('success', "<strong>{$fullname}</strong> exitosamente adicionado en le base de datos");
}
示例10: run
public function run()
{
Eloquent::unguard();
Admin::create(array('username' => 'admin', 'password' => Hash::make('admin')));
}
示例11: create
public static function create($username, $email, $division, $clearance, $name, $rank, $password)
{
global $mysqli;
$pass = md5($password);
$insert = $mysqli->query("INSERT INTO users VALUE (NULL, '{$username}', '{$pass}', '{$email}', {$rank}, '', '0000-00-00 00:00:00', '{$name}', {$clearance}, {$division}, 0, 0, 0, 0, 0)");
if (!$insert) {
throw new DBException('Could not create user.', $mysqli->error);
}
$id = $mysqli->insert_id;
$insert = $mysqli->query("INSERT INTO awards VALUE ({$id}, '', '')");
if ($clearance == 7) {
Admin::create($id, 1, 0);
}
}
示例12: parseAdmins
public function parseAdmins($admins) {
//echo "Was commented";
//echo $admins[0]."<br>";
foreach ($admins as $admin) {
//echo $admin."<br>";
try {
Admin::create(array('name'=>$admin));
} catch (\exception $e) {
echo "Exception";
}
}
//print_r($admins);
}
示例13: run
public function run()
{
Admin::create(['role_id' => 1, 'email' => 'trantunghn196@gmail.com', 'password' => Hash::make('123456'), 'username' => 'tung1984']);
}
示例14: create_object
public function create_object($data, $user_field = 'user')
{
$admin = Admin::create($data)->set_user_field($user_field);
return $admin;
}
示例15: run
public function run()
{
DB::table('admins')->delete();
Admin::create(array('account' => 'admin', 'pwd' => Hash::make('admin'), 'name' => '超级管理员'));
}