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')));
 }
 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');
         }
     }
 }
 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;
     }
 }
 /**
  * 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');
 }
 /** @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]);
 }
Beispiel #6
0
 /**
  * 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' => '*****@*****.**', 'password' => 'pass']);
     Model::reguard();
 }
 /**
  * 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');
         }
     }
 }
Beispiel #8
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $users = [['f_name' => 'John', 'l_name' => 'Doe', 'email' => '*****@*****.**', 'password' => bcrypt('password'), 'semester_id' => 13, 'department' => 'EEE', 'phone' => '+8801760099824'], ['f_name' => 'Jane', 'l_name' => 'Diana', 'email' => '*****@*****.**', 'password' => bcrypt('password'), 'semester_id' => 7, 'department' => 'BBS', 'phone' => '+8801760099824'], ['f_name' => 'Martha', 'l_name' => 'Jane', 'email' => '*****@*****.**', 'password' => bcrypt('password'), 'semester_id' => 10, 'department' => 'ESS', 'phone' => '+8801760099824'], ['f_name' => 'Jeffery', 'l_name' => 'Way', 'email' => '*****@*****.**', 'password' => bcrypt('password'), 'semester_id' => 9, 'department' => 'SECS', 'phone' => '+8801760099824', 'role' => 'faculty'], ['f_name' => 'Abdur', 'l_name' => 'Rahman', 'email' => '*****@*****.**', 'password' => bcrypt('password'), 'semester_id' => 5, 'department' => 'SECS', 'phone' => '+8801760099824', 'role' => 'faculty'], ['f_name' => 'Atef', 'l_name' => 'Haque', 'email' => '*****@*****.**', '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);
     }
 }
 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");
 }
Beispiel #10
0
 public function run()
 {
     Eloquent::unguard();
     Admin::create(array('username' => 'admin', 'password' => Hash::make('admin')));
 }
Beispiel #11
0
 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);
     }
 }
    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);
        
        
    }  
Beispiel #13
0
 public function run()
 {
     Admin::create(['role_id' => 1, 'email' => '*****@*****.**', 'password' => Hash::make('123456'), 'username' => 'tung1984']);
 }
Beispiel #14
0
 public function create_object($data, $user_field = 'user')
 {
     $admin = Admin::create($data)->set_user_field($user_field);
     return $admin;
 }
Beispiel #15
0
 public function run()
 {
     DB::table('admins')->delete();
     Admin::create(array('account' => 'admin', 'pwd' => Hash::make('admin'), 'name' => '超级管理员'));
 }
Beispiel #16
0
 public static function tambah($foto, $nama, $username, $password)
 {
     Admin::create(compact('foto', 'nama', 'username', 'password'));
 }
Beispiel #17
0
 public function testBeforeSaveOnInsert()
 {
     $connection = m::mock('juicyORM\\Database\\DbConnection');
     $connection->shouldReceive('query')->with('INSERT INTO "admin" ("username", "email") VALUES (?, ?)', array('Steve', '*****@*****.**'), false)->once()->andReturn(true);
     $connection->shouldReceive('lastInsertId')->with('admin_id')->once()->andReturn('5');
     $connection->shouldReceive('query')->with('SELECT * FROM "admin" WHERE "admin_id" = ?', array('5'))->once()->andReturn(array(array("user_id" => 3, "username" => "Steve", "email" => "*****@*****.**")));
     $db = juicyORM\Database\DB::Instance($this->dbConfig, $connection, true);
     $admin = new Admin($db);
     $user_response = $admin->create(array("username" => "Derek", "email" => "*****@*****.**"));
     $this->assertEquals(gettype($user_response), 'object');
     $this->assertEquals(get_class($user_response), 'juicyORM\\Database\\ModelRow');
     $this->assertEquals($user_response->username, 'Steve');
     $this->assertEquals($db->runtime_info(), array(array('sql' => 'INSERT INTO "admin" ("username", "email") VALUES (?, ?)', 'bindings' => array('Steve', '*****@*****.**')), array('sql' => 'SELECT * FROM "admin" WHERE "admin_id" = ?', 'bindings' => array('5'))));
 }
Beispiel #18
0
 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array  $data
  * @return User
  */
 protected function create(array $data)
 {
     return Admin::create(['name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password'])]);
 }
#!/usr/bin/php
<?
/**
 * create a first admin user
 *
 * @author Magnus Rosenbaum <*****@*****.**>
 * @package Basisentscheid
 */


if ( $dir = dirname($_SERVER['argv'][0]) ) chdir($dir);
const DOCROOT = "../";
require "../inc/common_cli.php";

$a = new Admin;
$a->username = "******";
$a->password = crypt("test");
$a->create();
Beispiel #20
0
     <?php 
     } else {
         if ($do == 'add') {
             extract($_POST);
             if (!empty($others)) {
                 $teams = $others;
             }
             if ($primary == '') {
                 echo 'Primary Team Not Specified';
             } else {
                 if (!isset($teams) || $teams == '') {
                     $teams = array($primary);
                 } else {
                     array_unshift($teams, $primary);
                 }
                 Admin::create($user, $rank, $teams);
                 echo 'true';
             }
         }
     }
 } else {
     if ($action == 'edit') {
         $user = new User($_GET['id']);
         if ($do == 'none') {
             ?>
     <form action="#" method="post" id="form">
         <table>
             <tr>
                 <th><label for="rank">Rank:</label></th>
                 <td>
                     <select id="rank" name="rank">