public function test_bouncer_can_fill_an_ability_model() { $bouncer = $this->bouncer($user = User::create()); $ability = $bouncer->ability(['name' => 'test-ability']); $this->assertInstanceOf(Ability::class, $ability); $this->assertEquals('test-ability', $ability->name); }
/** * Store a newly created user in storage. * * @return Response */ public function store() { app('Pingpong\\Admin\\Validation\\User\\Create')->validate($data = $this->inputAll()); $user = $this->users->create($data); $user->addRole(\Input::get('role')); return $this->redirect('users.index'); }
/** * Store a newly created resource in storage. * * @return Response */ public function register() { $input = Input::all(); $validation = Validator::make($input, User::$rules); // dd($input); Log::info($input); if ($validation->passes()) { $input['password'] = Hash::make($input['password']); $result = $this->user->create($input); $data = ['patient_id' => $result->id]; $data['patient_information_id'] = $this->patientinformation->create($data)->id; $this->medicalrecord->create($data); // return Redirect::route('users.index'); $data['message'] = "User successfully registered. Please login to continue."; $data['error'] = false; return $data; } $mess = ""; $messages = $validation->messages(); foreach ($messages->all() as $message) { $mess .= $message; } $output = array('error' => true, 'message' => $mess); return $output; /* return Redirect::route('users.create') ->withInput() ->withErrors($validation) ->with('message', 'There were validation errors.'); */ }
/** * Store a newly created resource in storage. * * @return Response */ public function store() { $input = Input::all(); $validation = Validator::make($input, User::$rules); if ($validation->passes()) { $input['password'] = Hash::make(Input::get('password')); $this->user->create($input); return Redirect::route('users.index'); } return Redirect::route('users.create')->withInput()->withErrors($validation)->with('message', 'There were validation errors.'); }
function createArticle() { $user = new User($this->mySQL); $news_item = $this->mySQL['r']->query("SELECT * FROM `news_articles` WHERE `ID`='" . $this->articleID . "'"); $news = array(); if ($news_item !== false && $news_item->num_rows != 0) { while ($item = $news_item->fetch_array()) { $article['author'] = $user->create($item['pub_a']); $article['author'] = $user->getName(); $article['editer'] = $user->create($item['edit_a']); $article['editer'] = $user->getName(); $article['title'] = $item['title']; if ($this->publish) { $article['pub'] = "<small>Published: " . date("H:i:s, D d/m/Y", strtotime($item['t_p'])) . "</small>"; $article['edit'] = "<small>Edited: " . date("H:i:s, D d/m/Y", strtotime($item['t_e'])) . "</small>"; if ($item['t_p'] != $item['t_e']) { $this->editPub = true; } else { $this->editPub = false; } } else { $article['edit'] = $article['pub'] = ""; } if ($item['long'] == "") { $this->long = false; } else { $this->long = true; } if ($this->preview) { $article['content'] = $item['short']; } else { if ($item['long'] != "") { $article['content'] = "<b>" . $item['short'] . "</b><br />" . "\n" . $item['long']; } else { $article['content'] = $item['short']; } } } } else { $article = false; } $this->article = $article; if ($article === false) { return false; } else { return true; } }
public function run() { $users = [['name' => 'Alexander Olly', 'address' => 'Melbourne, Australia', 'bday' => '03-18-1996', 'contact_no' => '09058593592', 'username' => 'alexander90', 'password' => Hash::make('awesome'), 'role' => 'admin'], ['name' => 'Justin Bieber', 'address' => 'Stratford, Ontario, Canada', 'bday' => '03-01-1994', 'contact_no' => '09058593592', 'username' => 'kidrauhl', 'password' => Hash::make('jelena'), 'role' => 'customer'], ['name' => 'Gabrielle Luna', 'address' => 'Maranding, Lala, Lanao del Norte', 'bday' => '03-18-1996', 'contact_no' => '09058593592', 'username' => 'gaboluna96', 'password' => Hash::make('keeperoflight'), 'role' => 'cashier']]; foreach ($users as $user) { User::create($user); } }
function _ops_update() { require_login(); $msg = ''; $uid = max(0, intval($_POST['uid'])); $user = new User(); if ($uid) { $user->retrieve($uid); $user->merge($_POST); if (!$user->exists()) { $msg = 'User not found!'; } else { if ($user->update()) { $msg = 'User updated!'; } else { $msg = 'User update failed!'; } } } else { $user->merge($_POST); if ($user->create()) { $msg = 'User inserted!'; } else { $msg = 'User insert failed!'; } } redirect('users/manage', $msg); }
public function run() { DB::table('users')->delete(); User::create(array('username' => 'talha', 'password' => Hash::make('talha'), 'email' => '*****@*****.**', 'phone' => '01234', 'name' => 'MD. ABU TALHA', 'created_at' => new DateTime(), 'updated_at' => new DateTime())); DB::table('users')->insert(['username' => 'talha1', 'password' => Hash::make('talha1'), 'email' => '*****@*****.**', 'phone' => '012341', 'name' => 'MD. ABU TALHA1', 'created_at' => new DateTime(), 'updated_at' => new DateTime()]); DB::table('users')->insert(['username' => 'talha2', 'password' => Hash::make('talha2'), 'email' => '*****@*****.**', 'phone' => '012342', 'name' => 'MD. ABU TALHA2', 'created_at' => new DateTime(), 'updated_at' => new DateTime()]); }
/** * Make changes to the database. * * @return void */ public function up() { Schema::table('users', function ($table) { $table->create(); $table->increments('id'); $table->string('email'); $table->string('firstname'); $table->string('lastname'); $table->string('street'); $table->string('city'); $table->string('state', 2); $table->integer('zipcode'); $table->string('phone', 10)->nullable(); $table->string('account', 32)->nullable()->unique(); $table->string('token', 32)->nullable(); $table->timestamps(); }); $seed = array(array(1, '*****@*****.**', 'James', 'Bullard', '7027 Williamsburg Blvd', 'Arlington', 'VA', 22213, '9107996952', NULL, NULL, new DateTime(), new DateTime()), array(2, '*****@*****.**', 'James', 'Bullard', '3911 Appleton Way', 'Wilmington', 'NC', 28412, '9107996952', NULL, NULL, new DateTime(), new DateTime()), array(3, '*****@*****.**', 'James', 'Bullard', '1441 Rhode Island Ave., NW Apt 209', 'Washington', 'DC', 20005, '9107996952', NULL, NULL, new DateTime(), new DateTime())); foreach ($seed as $rec) { $fields = array('id', 'email', 'firstname', 'lastname', 'street', 'city', 'state', 'zipcode', 'phone', 'account', 'token', 'create_at', 'updated_at'); $insert = array(); foreach ($fields as $key => $field) { $insert[$field] = $rec[$key]; } $user = User::create($insert); $user->generate_account_hash(Config::get('litmus::private_key'))->save(); } }
public function setupFoundorAndBaseRolsPermission() { // Create Roles $founder = new Role(); $founder->name = 'Founder'; $founder->save(); $admin = new Role(); $admin->name = 'Admin'; $admin->save(); // Create User $user = User::create(['id' => 1, 'username' => 'zhanglei', 'password' => Hash::make('zhanglei'), 'email' => '*****@*****.**']); // Attach Roles to user $user->roles()->attach($founder->id); // Create Permissions $manageTopics = new Permission(); $manageTopics->name = 'manage_topics'; $manageTopics->display_name = 'Manage Topics'; $manageTopics->save(); $manageUsers = new Permission(); $manageUsers->name = 'manage_users'; $manageUsers->display_name = 'Manage Users'; $manageUsers->save(); // Assign Permission to Role $founder->perms()->sync([$manageTopics->id, $manageUsers->id]); $admin->perms()->sync([$manageTopics->id]); }
public function run() { Banner::truncate(); Website::truncate(); $user = User::create(array("username" => "danheyman", "name" => "Daniel Heyman", "email" => "*****@*****.**", "password" => "hello", "newsletter" => true, "admin_emails" => true, "membership" => "platinum", "paypal" => "", "membership_expires" => Carbon::now()->addMonth(), "referrals" => 0, "upline" => "", "cash" => 0, "credits" => 0, "credits_today" => 0, "views_total" => 0, "views_today" => 0, 'auto_assign' => 0, 'register_ip' => Request::getClientIp(), 'last_login' => Carbon::now())); for ($x = 0; $x < 20; $x++) { $website = new Website(); $website->url = "http://listviral.com"; $website->enabled = true; $website->credits = 10000; $website->views = 0; $website->days = array(); $website->hours = array(); $user->websites()->save($website); $banner = new Banner(); $banner->banner = "http://brisksurf.com/banner.png"; $banner->url = "http://brisksurf.com"; $banner->enabled = true; $banner->credits = 10000; $banner->views = 0; $banner->days = array(); $banner->hours = array(); $user->banners()->save($banner); } }
public function run() { /** * $userModel = User::find(1); * $userModel->detachRoles($userModel->roles); */ DB::statement('SET FOREIGN_KEY_CHECKS=0;'); DB::table('roles')->truncate(); DB::table('roles')->delete(); DB::table('assigned_roles')->truncate(); DB::table('assigned_roles')->delete(); DB::table('users')->truncate(); DB::table('users')->delete(); User::create(array('firstname' => 'Администратор', 'email' => '*****@*****.**', 'password' => Hash::make('123456'))); User::create(array('firstname' => 'Богдан', 'email' => '*****@*****.**', 'password' => Hash::make('123456'))); $role = new Role(); $role->name = 'Customer'; $role->save(); $role = new Role(); $role->name = 'Admin'; $role->save(); $admin = User::where('firstname', '=', 'Администратор')->first(); $admin->attachRole($role); $user = User::where('firstname', '=', 'Богдан')->first(); $user->attachRole($role); DB::statement('SET FOREIGN_KEY_CHECKS=1;'); }
public function run() { $faker = Faker::create(); foreach (range(1, 2) as $index) { User::create(['role_id' => 1, 'username' => $faker->userName, 'password' => Hash::make('sandip'), 'first_name' => $faker->firstName, 'last_name' => $faker->lastName, 'email' => $faker->email, 'gender' => 'male']); } }
function step2($data) { //eseguo lo script MySQL if (!$this->mySqlInstall()) { $this->validationErrors['script_db'] = 'Errore nella compilazione del database'; return false; } //inserisco i dati di configurazione dell'utente admin App::import('model', 'User'); $User = new User(); $User->create(array('User' => array('first_name' => $data['admin_first_name'], 'last_name' => $data['admin_last_name'], 'username' => $data['admin_username'], 'password' => Security::hash($data['admin_pwd'], null, true), 'email' => $data['admin_email'], 'role' => 0, 'active' => 1))); if (!$User->save()) { return false; } //scrivo il file installed.txt nella directory config App::import('core', 'File'); $installedFile = new File(APP . 'config' . DS . 'installed.txt'); $installedFile->create(); //imposto correttamente i permessi sulle directories per la produzione if (!$this->setFolderPermissions($this->writableDirsForInstall, '0755')) { return false; } if (!$this->setFolderPermissions($this->writableDirsForProduction, '0755')) { return false; } //tutto ok return true; }
public function postregisterUser() { /* * Validation */ $validation = Validator::make(Input::all(), array('username' => 'required|max:20|min:5|unique:users', 'fullname' => 'required|max:40', 'email' => 'required|max:50|email|unique:users', 'password' => 'required|min:6')); if ($validation->fails()) { return Redirect::route('registration')->withErrors($validation)->withInput(); } else { //Create a user $username = Input::get('username'); $fullname = Input::get('fullname'); $email = Input::get('email'); $password = Input::get('password'); //Activation Code $code = str_random(60); $user = User::create(array('username' => $username, 'fullname' => $fullname, 'email' => $email, 'password' => Hash::make($password), 'code' => $code, 'active' => 0)); if ($user) { //Send mail Mail::send('emails.auth.activate', array('link' => URL::route('activateAccount', $code), 'username' => $fullname), function ($message) use($user) { $message->to($user->email, $user->fullname)->subject('Activate your account'); }); return View::make('users.registerConfirm')->with('title', 'Registration SuccessFul')->with('userFullName', $fullname)->with('userEmail', $email); } } }
public function run() { $faker = Faker\Factory::create(); for ($i = 0; $i < 10; $i++) { $user = User::create(array('email' => $faker->email, 'username' => $faker->unique->username, 'password' => $faker->word, 'remember_token' => str_random(50))); } }
public function run() { $faker = Faker::create(); foreach (range(1, 50) as $index) { User::create(['github_id' => $index, 'github_url' => $faker->url(), 'city' => $faker->city(), 'name' => $faker->userName(), 'twitter_account' => $faker->userName(), 'company' => $faker->userName(), 'personal_website' => $faker->url(), 'signature' => $faker->sentence(), 'introduction' => $faker->sentence(), 'email' => $faker->email()]); } }
public function setupFoundorAndBaseRolsPermission() { // Create Roles $founder = new Role(); $founder->name = 'Founder'; $founder->save(); $admin = new Role(); $admin->name = 'Admin'; $admin->save(); // Create User $user = User::create(['github_id' => 324764, 'github_url' => 'https://github.com/summerblue', 'name' => 'summerblue']); // Attach Roles to user $user->roles()->attach($founder->id); // Create Permissions $manageTopics = new Permission(); $manageTopics->name = 'manage_topics'; $manageTopics->display_name = 'Manage Topics'; $manageTopics->save(); $manageUsers = new Permission(); $manageUsers->name = 'manage_users'; $manageUsers->display_name = 'Manage Users'; $manageUsers->save(); // Assign Permission to Role $founder->perms()->sync([$manageTopics->id, $manageUsers->id]); $admin->perms()->sync([$manageTopics->id]); }
public function run() { User::create(array('group_id' => 1, 'name' => 'Разработчик', 'surname' => '', 'email' => '*****@*****.**', 'active' => 1, 'password' => Hash::make('grapheme1234'), 'photo' => '', 'thumbnail' => '', 'temporary_code' => '', 'code_life' => 0, 'remember_token' => 'Ycr4p62EPv3x3UWabeo3NpiSdJmI7hT3E460C5eTuiFKp1Vbjg6WL2M2bmPv')); DB::table('sessions')->insert(array(array('id' => '80b1264be73168dfa026345d79abc86a1d29660c', 'payload' => 'YTo2OntzOjY6Il90b2tlbiI7czo0MDoiQXVsQ0M1Y0dhQTJMV2lKWVF4VTVlUkRtZ0s0NE5wdFRHeXh2eEdjMSI7czo2OiJsb2NhbGUiO3M6MjoicnUiO3M6MjI6IlBIUERFQlVHQkFSX1NUQUNLX0RBVEEiO2E6MDp7fXM6NToiZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319czozODoibG9naW5fODJlNWQyYzU2YmRkMDgxMTMxOGYwY2YwNzhiNzhiZmMiO2k6MTtzOjk6Il9zZjJfbWV0YSI7YTozOntzOjE6InUiO2k6MTQxNjM5OTU3MztzOjE6ImMiO2k6MTQxNjM5Mzg3ODtzOjE6ImwiO3M6MToiMCI7fX0=', 'last_activity' => time()))); User::create(array('group_id' => 2, 'name' => 'Администратор', 'surname' => '', 'email' => '*****@*****.**', 'active' => 1, 'password' => Hash::make('grapheme1234'), 'photo' => '', 'thumbnail' => '', 'temporary_code' => '', 'code_life' => 0)); User::create(array('group_id' => 3, 'name' => 'Модератор', 'surname' => '', 'email' => '*****@*****.**', 'active' => 1, 'password' => Hash::make('grapheme1234'), 'photo' => '', 'thumbnail' => '', 'temporary_code' => '', 'code_life' => 0)); }
/** * This function create employee * when data is posted from * /admin/employee/create */ public function postCreate() { // Check validation $validator = Validator::make(Input::all(), Employee::$rulesForCreate, Employee::$messages); // If failed then redirect to employee-create-get route with // validation error and input old if ($validator->fails()) { return Redirect::route('employee-create-get')->withErrors($validator)->withInput(); } // If validation is not failed then create employee $employee = Employee::create(array('first_name' => Input::get('first_name'), 'last_name' => Input::get('last_name'), 'age' => Input::get('age'), 'gender' => Input::get('gender'), 'DOB' => DateFormat::store(Input::get('DOB')), 'present_address' => Input::get('present_address'), 'permanent_address' => Input::get('permanent_address'), 'city' => Input::get('city'), 'state' => Input::get('state'), 'country' => Input::get('country'), 'mobile_no' => Input::get('mobile_no'), 'email' => Input::get('email'), 'created_by' => Session::get('username'))); // Also create user account for the employee $user = User::create(array('details_id' => $employee->id, 'username' => Input::get('username'), 'email' => $employee->email, 'user_level' => Input::get('userlevel'), 'active' => 0)); // generate random code and password $password = str_random(10); $code = str_random(60); $newHashPassword = Hash::make($password); // Save new password and code $user->password_tmp = $newHashPassword; $user->activation_code = $code; if ($user->save()) { // Send email to the employee. // This email contains username,password,activation link Mail::send('emails.auth.activation', array('first_name' => $employee->first_name, 'last_name' => $employee->last_name, 'username' => $user->username, 'password' => $password, 'activation_link' => URL::route('activation-get', $code)), function ($message) use($user) { $message->to($user->email, $user->username)->subject('Confirm Activation'); }); } return View::make('adminArea.employee.create')->with('success', 'Activation link has been sent successfully'); }
public function run() { $faker = Faker::create(); foreach (range(1, 10) as $index) { User::create(['email' => $faker->email(), 'name' => $faker->name(), 'password' => $faker->password()]); } }
public function create() { $user = new User(); $user->login = '******'; $user->email = '*****@*****.**'; $user->create(); }
/** * @param array $attributes */ public function loadRelated(array $attributes) { parent::loadRelated($attributes); if (isset($attributes['user'])) { $this->user = User::create($attributes['user']); } }
public function run() { $faker = Faker::create(); foreach (range(1, 10) as $index) { User::create([]); } }
public function testShouldUpdateUser() { $user = User::create(['username' => 'ajcastro', 'password' => 'password', 'name' => 'arjon_x', 'email' => '*****@*****.**', 'password' => '123456']); $updatedUser = $this->repo->update($user->id, ['name' => 'arjon']); $this->assertEquals('arjon', User::findOrFail($user->id)->name); $this->assertTrue($updatedUser instanceof User); }
public function register() { $user = User::create(['email' => '*****@*****.**', 'password' => Hash::make('mmarrk')]); $user->access = 1; $user->save(); return 'done'; }
/** * Create a new user * * @param $email */ public function createAction($email) { if (!$this->isValidEmail($email)) { die("'{$email}' is not a valid email address\n"); } if ($user = User::findFirst(['email = :email:', 'bind' => ['email' => $email]])) { die("The account {$email} already exists. Duplicate account emails are not allowed.\n"); } echo "Creating user '{$email}'\n"; $password = $this->promptCreatePassword(); echo "Keying...\n"; $user = new User(); $user->email = $email; $user->setPassword($password); // Create OTP key $otp = Seed::generate(40); $user->setOtpKey($otp->getValue(Seed::FORMAT_BASE32), $password); // Create account key $key = Key::generate($user->dangerouslyRegenerateAccountKeyPassphrase($password)); $key->setName('Account key'); // Save user and key $this->db->begin(); $user->create(); $key->user_id = $user->id; $key->create(); $user->accountKey_id = $key->id; $user->update(); $this->db->commit(); echo "Created user {$email} with id {$user->id}\n"; echo "OTP: {$this->generateOtpUri($user, $otp)}\n"; }
public function run() { DB::table('users')->delete(); User::create(array('user_id' => 1, 'name' => 'Wade', 'email' => '*****@*****.**', 'password' => Hash::make('a1!'))); User::create(array('user_id' => 2, 'name' => 'Ryan', 'email' => '*****@*****.**', 'password' => Hash::make('b2@'))); User::create(array('user_id' => 3, 'name' => 'Mark', 'email' => '*****@*****.**', 'password' => Hash::make('c3#'))); }
public function run() { //------------------------------------------------------------------ Students DB::table('users')->delete(); User::create(array('name' => 'Karol Kuzora', 'username' => 'KuzoraK', 'email' => '*****@*****.**', 'password' => Hash::make('123'), 'access' => 0, 'field_id' => 1)); User::create(array('name' => 'Stefan Przepiórczy', 'username' => 'PrzepiórczyS', 'email' => '*****@*****.**', 'password' => Hash::make('123'), 'access' => 0, 'field_id' => 1)); User::create(array('name' => 'Anna Mała', 'username' => 'MałaA', 'email' => '*****@*****.**', 'password' => Hash::make('123'), 'access' => 0, 'field_id' => 2)); User::create(array('name' => 'Tadeusz Woźny', 'username' => 'WoźnyT', 'email' => '*****@*****.**', 'password' => Hash::make('123'), 'access' => 0, 'field_id' => 3)); User::create(array('name' => 'Wojciech Pocieszny', 'username' => 'PociesznyW', 'email' => '*****@*****.**', 'password' => Hash::make('123'), 'access' => 0, 'field_id' => 4)); User::create(array('name' => 'Dorota Zawadzka', 'username' => 'ZawadzkaD', 'email' => '*****@*****.**', 'password' => Hash::make('123'), 'access' => 0, 'field_id' => 5)); User::create(array('name' => 'Szczepan Kaczka', 'username' => 'KaczkaS', 'email' => '*****@*****.**', 'password' => Hash::make('123'), 'access' => 0, 'field_id' => 6)); User::create(array('name' => 'Karol Kuzora', 'username' => 'KuzoraK1', 'email' => '*****@*****.**', 'password' => Hash::make('123'), 'access' => 0, 'field_id' => 1)); User::create(array('name' => 'Stefan Przepiórczy', 'username' => 'PrzepiórczyS1', 'email' => '*****@*****.**', 'password' => Hash::make('123'), 'access' => 0, 'field_id' => 1)); User::create(array('name' => 'Anna Mała', 'username' => 'MałaA1', 'email' => '*****@*****.**', 'password' => Hash::make('123'), 'access' => 0, 'field_id' => 2)); User::create(array('name' => 'Tadeusz Woźny', 'username' => 'WoźnyT1', 'email' => '*****@*****.**', 'password' => Hash::make('123'), 'access' => 0, 'field_id' => 3)); User::create(array('name' => 'Wojciech Pocieszny', 'username' => 'PociesznyW1', 'email' => '*****@*****.**', 'password' => Hash::make('123'), 'access' => 0, 'field_id' => 4)); User::create(array('name' => 'Dorota Zawadzka', 'username' => 'ZawadzkaD1', 'email' => '*****@*****.**', 'password' => Hash::make('123'), 'access' => 0, 'field_id' => 5)); User::create(array('name' => 'Szczepan Kaczka', 'username' => 'KaczkaS1', 'email' => '*****@*****.**', 'password' => Hash::make('123'), 'access' => 0, 'field_id' => 6)); //------------------------------------------------------------------ Lecturers User::create(array('name' => 'Antoni Krem', 'username' => 'KremA', 'email' => '*****@*****.**', 'password' => Hash::make('123'), 'access' => 1)); User::create(array('name' => 'Marian Wielki', 'username' => 'WielkiM', 'email' => '*****@*****.**', 'password' => Hash::make('123'), 'access' => 1)); User::create(array('name' => 'Bogumiła Wąs', 'username' => 'WąsB', 'email' => '*****@*****.**', 'password' => Hash::make('123'), 'access' => 1)); //------------------------------------------------------------------ Boss User::create(array('name' => 'Adam Profesor', 'username' => 'Admin', 'email' => '*****@*****.**', 'password' => Hash::make('123'), 'access' => 2)); }
public function run() { $user = User::create(['name' => 'Administrator', 'username' => 'crmadmin', 'email' => '*****@*****.**', 'password' => 'rajawat']); if (!$user->hasRole('admin')->first()) { $user->roles()->attach(1); } }