本文整理汇总了PHP中app\User::insert方法的典型用法代码示例。如果您正苦于以下问题:PHP User::insert方法的具体用法?PHP User::insert怎么用?PHP User::insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\User
的用法示例。
在下文中一共展示了User::insert方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
/**
* Method Name :Store
* Insert data to User Table and consequencesly insert to Account, Carries and Downline table
*
*
*/
public function store(UserRegRequest $request, User $user)
{
$uplineUser = User::where('username', $request->upline_id)->first();
$referrarUser = User::where('username', $request->referrar_id)->first();
$uplineId = $uplineUser->id;
$requestValue = $request->placement;
// return $request->full_name . "++". preg_replace('/\s+/', '', strtolower($request->username));
// $username =
$address = $request->address1 . "," . $request->address2;
// return
$user->insert([['username' => preg_replace('/\\s+/', '', strtolower($request->username)), 'full_name' => $request->full_name, 'gender' => $request->gender, 'email' => $request->email, 'password' => bcrypt($request->password), 'remember_token' => $request->_token, 'address' => $address, 'phone_number' => $request->phone_number, 'country' => $request->country, 'account_no' => 555210, 'referrar_id' => $referrarUser->id, 'upline_id' => $uplineUser->id, 'pin' => rand(1, 99999999), 'signup_date' => Carbon::now(), 'last_login_time' => Carbon::now()]]);
$lastRegUser = $user->where('username', preg_replace('/\\s+/', '', strtolower($request->username)))->first();
$role = Role::where('id', 3)->first();
$lastRegUser->assign($role);
Account::insert(['balance' => 0, 'roi_balance' => 0, 'user_id' => $lastRegUser->id, 'acc_type' => '0']);
Carry::insert(['user_id' => $lastRegUser->id, 'left_carry' => 0, 'right_carry' => 0, 'matching_qualify' => 0]);
Downline::insert(['user_id' => $lastRegUser->id, 'left_member_id' => 0, 'right_member_id' => 0]);
/*Downline::where('user_id', $uplineUser->id)
->update(['right_member_id' => $request->placement]);*/
/*return $downLineTable = Downline::where('user_id', $uplineId)->first();
if($downLineTable->left_member_id == 0 && $request->placement != 'right'){
Downline::where('user_id', $uplineUser->id)
->update(['left_member_id' => $lastRegUser->id]);
}
else
{
Downline::where('user_id', $uplineUser->id)
->update(['right_member_id' => $lastRegUser->id]);
}
*/
$position = preg_replace('/\\s+/', '', strtolower($requestValue)) . "_member_id";
Downline::where('user_id', $uplineUser->id)->update([$position => $lastRegUser->id]);
return redirect()->back();
}
示例2: run
public function run()
{
Category::create(array('id' => 1, 'category' => 'TestParent'));
Category::create(array('id' => 2, 'category' => 'TestChild', 'parent_id' => 1));
User::insert(array('name' => 'joe', 'email' => 'foo@bar.com', 'password' => 'adasdas'));
\Kevupton\Bookings\Models\Equipment::insert(array('name' => 'Chairs', 'longitude' => 0, 'latitude' => 0, 'address' => 'yoyo', 'qty' => 100));
\Kevupton\Bookings\Models\Classification::insert(array('code' => 'PG', 'name' => 'Parental Guidance'));
$event = \Kevupton\Bookings\Models\Event::create(array('name' => 'How', 'category_id' => 2, 'classification_code' => 'PG'));
$insert = \Kevupton\Bookings\Models\Venue::create(array('name' => 'SmartVille', 'is_bookable' => 1, 'longitude' => 0, 'latitude' => 0, 'address' => 'Wowo', 'capacity' => 100));
$timetable = $insert->timetable()->create(array());
foreach (TimetableDayRepository::daysOfWeek() as $day) {
${$day} = $timetable->days()->create(array('day' => $day, 'from' => '07:01:00', 'to' => '09:01:01'));
}
$MONDAY->to = '24:00:00.000000';
$MONDAY->save();
$TUESDAY->from = '00:00:00.000000';
$TUESDAY->to = '24:00:00.000000';
$TUESDAY->save();
$WEDNESDAY->from = '00:00:00.000000';
$WEDNESDAY->to = '24:00:00.000000';
$WEDNESDAY->save();
$THURSDAY->from = '00:00:00.000000';
$THURSDAY->save();
$timetable->specifics()->create(array('is_available' => 1, 'from' => '2017-02-01 09:01:01', 'to' => '2017-03-01 09:01:01'));
Session::create(array('event_id' => $event->id, 'venue_id' => $insert->id, 'duration' => 60, 'timetable_id' => $timetable->id, 'from' => '2017-02-01 09:01:01', 'to' => '2017-03-01 09:01:01', 'name' => 'pinokio'));
Session::create(array('event_id' => $event->id, 'venue_id' => $insert->id, 'duration' => 120, 'timetable_id' => $timetable->id, 'from' => '2017-02-01 08:01:01', 'to' => '2017-02-01 08:31:01', 'name' => 'pinokio2'));
\Kevupton\Bookings\Models\SessionEquipment::insert(array(array('session_id' => 1, 'equipment_id' => 1, 'qty' => 10), array('session_id' => 2, 'equipment_id' => 1, 'qty' => 50)));
\Kevupton\Bookings\Models\SessionItem::insert(array(array('session_id' => 1, 'name' => "GOLD Ticket", 'price' => 10000, 'qty' => 100), array('session_id' => 2, 'name' => "GOLD Ticket", 'price' => 10000, 'qty' => 100)));
\Kevupton\Bookings\Models\Ticket::insert(array('session_item_id' => 1, 'user_id' => 1));
\Kevupton\Bookings\Models\VenueEquipment::insert(array('venue_id' => 1, 'equipment_id' => 1));
}
示例3: run
public function run()
{
Korisnici::insert([['username' => 'admin', 'password' => bcrypt('admin'), 'email' => 'admin@gmail.com', 'prava_pristupa_id' => 5, 'foto' => '/img/kontakt/korisnik-5.jpg', 'aktivan' => 1, 'grad_id' => 3, 'telefon' => '065098765', 'ime' => 'Админ', 'prezime' => 'Админовић'], ['username' => 'moderator', 'password' => bcrypt('moderator'), 'email' => 'administrator@gmail.com', 'prava_pristupa_id' => 4, 'foto' => '/img/kontakt/korisnik-4.jpg', 'aktivan' => 1, 'grad_id' => 3, 'telefon' => '062345678', 'ime' => 'Модератор', 'prezime' => 'Модератовић'], ['username' => 'korisnik', 'password' => bcrypt('korisnik'), 'email' => 'korisnik@gmail.com', 'prava_pristupa_id' => 2, 'foto' => '/img/kontakt/korisnik-3.jpg', 'aktivan' => 1, 'grad_id' => 2, 'telefon' => '061234567', 'ime' => 'Корисник', 'prezime' => 'Корисниковић'], ['username' => 'zabranjen', 'password' => bcrypt('zabranjen'), 'email' => 'zabranjen@gmail.com', 'prava_pristupa_id' => 2, 'foto' => '', 'aktivan' => 1, 'grad_id' => 3, 'telefon' => '0634567890', 'ime' => 'Забрањен', 'prezime' => 'Забрањеновић']]);
Udruzenje::insert([['vrsta_udruzenja_id' => 1, 'naziv' => 'Савез гуслара Србије', 'slug' => 'savez-guslara-srbije', 'korisnici_id' => 2, 'grad_id' => 2, 'datum_osnivanja' => '2000-05-23'], ['vrsta_udruzenja_id' => 1, 'naziv' => 'Савез гуслара Републике Српске', 'slug' => 'savez-guslara-republike-srpske', 'korisnici_id' => 2, 'grad_id' => 3, 'datum_osnivanja' => '1989-11-18'], ['vrsta_udruzenja_id' => 1, 'naziv' => 'Савез gуслара "Душаново царство"', 'slug' => 'savez-guslara-dusanovo-carstvo', 'korisnici_id' => 2, 'grad_id' => 4, 'datum_osnivanja' => '2005-10-22']]);
Udruzenje::insert([['vrsta_udruzenja_id' => 0, 'naziv' => '"Стара Херцеговина" Београд', 'slug' => 'stara-hercegovina-beograd', 'opis' => '"Стара Херцеговина" Београд "Стара Херцеговина" Београд "Стара Херцеговина" Београд "Стара Херцеговина" Београд "Стара Херцеговина" Београд "Стара Херцеговина" Београд ', 'savez_id' => 2, 'korisnici_id' => 2, 'grad_id' => 2, 'datum_osnivanja' => '1988-02-28'], ['vrsta_udruzenja_id' => 0, 'naziv' => '"Јован Чепић" Земун', 'slug' => 'jovan-cepic-zemun', 'opis' => '"Јован Чепић" Земун "Јован Чепић" Земун "Јован Чепић" Земун "Јован Чепић" Земун "Јован Чепић" Земун "Јован Чепић" Земун', 'savez_id' => 2, 'korisnici_id' => 2, 'grad_id' => 2, 'datum_osnivanja' => '2011-06-30'], ['vrsta_udruzenja_id' => 0, 'naziv' => '"Бајо Пивљанин" Земун', 'slug' => 'bajo-pivljanin-zemun', 'opis' => '"Бајо Пивљанин" Земун "Бајо Пивљанин" Земун "Бајо Пивљанин" Земун "Бајо Пивљанин" Земун "Бајо Пивљанин" Земун "Бајо Пивљанин" Земун "Бајо Пивљанин" Земун', 'savez_id' => 2, 'korisnici_id' => 2, 'grad_id' => 2, 'datum_osnivanja' => '1955-05-21'], ['vrsta_udruzenja_id' => 0, 'naziv' => '"Мајор Милан Тепић" Београд', 'slug' => 'major-milan-tepic-beograd', 'opis' => '"Мајор Милан Тепић" Београд "Мајор Милан Тепић" Београд "Мајор Милан Тепић" Београд "Мајор Милан Тепић" Београд "Мајор Милан Тепић" Београд "Мајор Милан Тепић" Београд "Мајор Милан Тепић" Београд ', 'savez_id' => 3, 'korisnici_id' => 2, 'grad_id' => 2, 'datum_osnivanja' => '2000-11-16'], ['vrsta_udruzenja_id' => 0, 'naziv' => '"Старина Новак" Пале', 'slug' => 'starina-novak-pale', 'opis' => '"Старина Новак" Пале "Старина Новак" Пале "Старина Новак" Пале "Старина Новак" Пале "Старина Новак" Пале "Старина Новак" Пале "Старина Новак" Пале "Старина Новак" Пале ', 'savez_id' => 3, 'korisnici_id' => 2, 'grad_id' => 2, 'datum_osnivanja' => '1892-07-13'], ['vrsta_udruzenja_id' => 0, 'naziv' => '"Војвода Мина Радовић" Подгорица', 'slug' => 'vojvoda-mina-radovic-podgorica', 'opis' => '"Војвода Мина Радовић" Подгорица "Војвода Мина Радовић" Подгорица "Војвода Мина Радовић" Подгорица "Војвода Мина Радовић" Подгорица "Војвода Мина Радовић" Подгорица "Војвода Мина Радовић" Подгорица "Војвода Мина Радовић" Подгорица ', 'savez_id' => 4, 'korisnici_id' => 2, 'grad_id' => 2, 'datum_osnivanja' => '1998-03-25']]);
DrustveniKorisnik::insert([['udruzenje_id' => 2, 'korisnici_id' => 3], ['udruzenje_id' => 3, 'korisnici_id' => 4], ['udruzenje_id' => 1, 'korisnici_id' => 5]]);
}
示例4: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$faker = Faker::create('pt_PT');
User::insert(array('nickname' => "user", 'email' => "user@gmail.com", 'password' => bcrypt("123"), 'remember_token' => str_random(10)));
for ($i = 0; $i < 5; $i++) {
User::insert(array('nickname' => $faker->unique()->numerify('User ###'), 'email' => $faker->email, 'password' => bcrypt("123")));
}
}
示例5: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
//delete
User::truncate();
//Insert
User::insert([['name' => 'admin', 'email' => 'admin@admin.com', 'password' => Hash::make('admin'), 'role' => 'admin', 'confirmed_at' => Carbon::now()]]);
//Insert
User::insert([['name' => 'user', 'email' => 'user@user.com', 'password' => Hash::make('user'), 'role' => 'user', 'confirmed_at' => Carbon::now()]]);
}
示例6: store
public function store(Request $request)
{
$allRequest = $request->all();
$userName = $allRequest['username'];
$sex = $allRequest['sex'];
$dataInsertToDatabase = array('username' => $userName, 'sex' => $sex);
$objUser = new User();
$objUser->insert($dataInsertToDatabase);
}
示例7: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::statement('SET FOREIGN_KEY_CHECKS=0;');
DB::table('users')->truncate();
DB::statement('SET FOREIGN_KEY_CHECKS=1;');
User::where('username', 'admin')->delete();
User::insert(array('name' => 'admin', 'email' => 'rbautista@chasetech.com', 'username' => 'admin', 'password' => Hash::make('noisyboy')));
// $admin = User::where('username', 'admin')->first();
// $admin->roles()->attach(1);
}
示例8: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$faker = \Faker\Factory::create();
User::truncate();
// DB::table('users')->insert([
User::insert([['name' => 'Kenn E. Thompson', 'email' => 'kennthompson@gmail.com', 'password' => bcrypt('abc123'), 'created_at' => new DateTime(), 'updated_at' => new DateTime()]]);
foreach (range(1, 99) as $index) {
User::insert(['name' => $faker->name, 'email' => $faker->email, 'password' => bcrypt('secret'), 'created_at' => dateTime($max = 'now'), 'updated_at' => dateTime($max = 'now')]);
}
}
示例9: run
public function run()
{
PravaPristupa::insert([['naziv' => 'Забрањен приступ'], ['naziv' => 'Корисник'], ['naziv' => 'Нижи модератор'], ['naziv' => 'Модератор'], ['naziv' => 'Администратор'], ['naziv' => 'Супер администратор']]);
Grad::insert([['naziv' => 'Недефинисан'], ['naziv' => 'Београд'], ['naziv' => 'Краљево'], ['naziv' => 'Фоча']]);
VrstaKorisnika::insert([['naziv' => 'Посетилац портала'], ['naziv' => 'Гуслар'], ['naziv' => 'Градитељ гусала'], ['naziv' => 'Фрулаш'], ['naziv' => 'Градитељ фрула'], ['naziv' => 'Градитељ дувачких инструмената'], ['naziv' => 'Дуборезац']]);
Korisnici::insert([['username' => 'SuperAdmin', 'password' => bcrypt('SuperAdmin'), 'email' => 'super.admin@gmail.com', 'prava_pristupa_id' => 6, 'foto' => '/img/kontakt/korisnik-6.jpg', 'aktivan' => 1, 'grad_id' => 2, 'telefon' => '065123456', 'ime' => 'Супер', 'prezime' => 'Фаца']]);
VrstaProizvoda::insert([['naziv' => 'Гусле', 'slug' => 'gusle'], ['naziv' => 'Дувачки инструменти', 'slug' => 'duvacki-insrumenti'], ['naziv' => 'Иконе', 'slug' => 'ikone'], ['naziv' => 'Народне ношње', 'slug' => 'narodne-nosnje'], ['naziv' => 'Радови у флаши', 'slug' => 'radovi-u-flasi'], ['naziv' => 'Дуборез за ловце', 'slug' => 'duborez-za-lovce'], ['naziv' => 'Сувенири', 'slug' => 'suveniri'], ['naziv' => 'Остало', 'slug' => 'ostalo']]);
StanjeOglasa::insert([['naziv' => 'Активан'], ['naziv' => 'Резервисан'], ['naziv' => 'У фази испоруке'], ['naziv' => 'Продат']]);
StanjeProizvoda::insert([['naziv' => 'Ново'], ['naziv' => 'Некориштен'], ['naziv' => 'Полован без оштећења'], ['naziv' => 'Полован са видљивим знацима кориштења'], ['naziv' => 'Неисправан']]);
Galerija::insert([['naziv' => 'Недефинисано'], ['naziv' => 'Портфолио']]);
VrstaSadrzaja::insert([['naziv' => 'Фотографија'], ['naziv' => 'Видео']]);
Udruzenje::insert([['vrsta_udruzenja_id' => 1, 'naziv' => 'Самостално друштво', 'grad_id' => 1, 'korisnici_id' => 1]]);
}
示例10: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$username = $request->input('username');
$password = $request->input('password');
$email = $request->input('email');
$avatar = $request->input('avatar');
$querySucceeded = User::insert(['username' => $username, 'password' => $password, 'email_address' => $email, 'avatar' => $avatar]);
if ($querySucceeded) {
$returnValue['status'] = 200;
$returnValue['message'] = 'OK';
return Response::json($returnValue, 200);
}
$returnValue['status'] = 400;
$returnValue['error_message'] = 'An error occurred while trying to store new user.';
return Response::json($returnValue, 400);
}
示例11: register
public function register(RegisterRequest $request)
{
if (!is_null($request->_error)) {
return view("dangky", array('errors' => $request->_error));
}
$email = $request->email;
$password = $request->password;
$fullname = $request->name;
$birthday = $request->birthday;
$array = ['email' => $email, 'password' => password_hash($password, PASSWORD_DEFAULT), 'name' => $fullname, 'birthday' => $birthday, 'permission_id' => 1, 'registration_at' => 'local', 'root_status' => 0];
$model = new User();
if ($model->insert($array) === true) {
redirect('');
}
redirect('dangky');
}
示例12: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
User::truncate();
$data = [['first_name' => 'admin', 'last_name' => 'admin', 'email' => 'admin@admin.com', 'username' => 'admin', 'password' => \Hash::make('123456'), 'birthday' => '1990-11-11', 'role_id' => 1, 'address' => 'address address', 'phone' => '123456'], ['first_name' => 'staff', 'last_name' => 'staff', 'email' => 'staff@staff.com', 'username' => 'staff', 'password' => \Hash::make('123456'), 'birthday' => '1990-11-11', 'role_id' => 2, 'address' => 'address address', 'phone' => '123456'], ['first_name' => 'member', 'last_name' => 'member', 'email' => 'member@member.com', 'username' => 'member', 'password' => \Hash::make('123456'), 'birthday' => '1990-11-11', 'role_id' => 3, 'address' => 'address address', 'phone' => '123456'], ['first_name' => '1', 'last_name' => '1', 'email' => '1@1.com', 'username' => 'lao1', 'password' => \Hash::make('123456'), 'birthday' => '1990-11-11', 'role_id' => 3, 'address' => 'address address', 'phone' => '123456'], ['first_name' => '1', 'last_name' => '1', 'email' => '1@1.com', 'username' => 'lao2', 'password' => \Hash::make('123456'), 'birthday' => '1990-11-11', 'role_id' => 3, 'address' => 'address address', 'phone' => '123456'], ['first_name' => '1', 'last_name' => '1', 'email' => '1@1.com', 'username' => 'lao3', 'password' => \Hash::make('123456'), 'birthday' => '1990-11-11', 'role_id' => 3, 'address' => 'address address', 'phone' => '123456'], ['first_name' => '1', 'last_name' => '1', 'email' => '1@1.com', 'username' => 'lao4', 'password' => \Hash::make('123456'), 'birthday' => '1990-11-11', 'role_id' => 3, 'address' => 'address address', 'phone' => '123456'], ['first_name' => '1', 'last_name' => '1', 'email' => '1@1.com', 'username' => 'lao5', 'password' => \Hash::make('123456'), 'birthday' => '1990-11-11', 'role_id' => 3, 'address' => 'address address', 'phone' => '123456'], ['first_name' => '1', 'last_name' => '1', 'email' => '1@1.com', 'username' => 'ngo1', 'password' => \Hash::make('123456'), 'birthday' => '1990-11-11', 'role_id' => 3, 'address' => 'address address', 'phone' => '123456'], ['first_name' => '1', 'last_name' => '1', 'email' => '1@1.com', 'username' => 'ngo2', 'password' => \Hash::make('123456'), 'birthday' => '1990-11-11', 'role_id' => 3, 'address' => 'address address', 'phone' => '123456'], ['first_name' => '1', 'last_name' => '1', 'email' => '1@1.com', 'username' => 'ngo3', 'password' => \Hash::make('123456'), 'birthday' => '1990-11-11', 'role_id' => 3, 'address' => 'address address', 'phone' => '123456'], ['first_name' => '1', 'last_name' => '1', 'email' => '1@1.com', 'username' => 'ngo4', 'password' => \Hash::make('123456'), 'birthday' => '1990-11-11', 'role_id' => 3, 'address' => 'address address', 'phone' => '123456'], ['first_name' => '1', 'last_name' => '1', 'email' => '1@1.com', 'username' => 'ngo5', 'password' => \Hash::make('123456'), 'birthday' => '1990-11-11', 'role_id' => 3, 'address' => 'address address', 'phone' => '123456'], ['first_name' => '1', 'last_name' => '1', 'email' => '1@1.com', 'username' => 'rua1', 'password' => \Hash::make('123456'), 'birthday' => '1990-11-11', 'role_id' => 3, 'address' => 'address address', 'phone' => '123456'], ['first_name' => '1', 'last_name' => '1', 'email' => '1@1.com', 'username' => 'rua2', 'password' => \Hash::make('123456'), 'birthday' => '1990-11-11', 'role_id' => 3, 'address' => 'address address', 'phone' => '123456'], ['first_name' => '1', 'last_name' => '1', 'email' => '1@1.com', 'username' => 'rua3', 'password' => \Hash::make('123456'), 'birthday' => '1990-11-11', 'role_id' => 3, 'address' => 'address address', 'phone' => '123456'], ['first_name' => '1', 'last_name' => '1', 'email' => '1@1.com', 'username' => 'rua4', 'password' => \Hash::make('123456'), 'birthday' => '1990-11-11', 'role_id' => 3, 'address' => 'address address', 'phone' => '123456'], ['first_name' => '1', 'last_name' => '1', 'email' => '1@1.com', 'username' => 'rua5', 'password' => \Hash::make('123456'), 'birthday' => '1990-11-11', 'role_id' => 3, 'address' => 'address address', 'phone' => '123456'], ['first_name' => '1', 'last_name' => '1', 'email' => '1@1.com', 'username' => 'chip1', 'password' => \Hash::make('123456'), 'birthday' => '1990-11-11', 'role_id' => 3, 'address' => 'address address', 'phone' => '123456'], ['first_name' => '1', 'last_name' => '1', 'email' => '1@1.com', 'username' => 'chip2', 'password' => \Hash::make('123456'), 'birthday' => '1990-11-11', 'role_id' => 3, 'address' => 'address address', 'phone' => '123456'], ['first_name' => '1', 'last_name' => '1', 'email' => '1@1.com', 'username' => 'chip3', 'password' => \Hash::make('123456'), 'birthday' => '1990-11-11', 'role_id' => 3, 'address' => 'address address', 'phone' => '123456'], ['first_name' => '1', 'last_name' => '1', 'email' => '1@1.com', 'username' => 'chip4', 'password' => \Hash::make('123456'), 'birthday' => '1990-11-11', 'role_id' => 3, 'address' => 'address address', 'phone' => '123456'], ['first_name' => '1', 'last_name' => '1', 'email' => '1@1.com', 'username' => 'chip5', 'password' => \Hash::make('123456'), 'birthday' => '1990-11-11', 'role_id' => 3, 'address' => 'address address', 'phone' => '123456'], ['first_name' => '1', 'last_name' => '1', 'email' => '1@1.com', 'username' => 'mem1', 'password' => \Hash::make('123456'), 'birthday' => '1990-11-11', 'role_id' => 3, 'address' => 'address address', 'phone' => '123456'], ['first_name' => '1', 'last_name' => '1', 'email' => '1@1.com', 'username' => 'mem2', 'password' => \Hash::make('123456'), 'birthday' => '1990-11-11', 'role_id' => 3, 'address' => 'address address', 'phone' => '123456'], ['first_name' => '1', 'last_name' => '1', 'email' => '1@1.com', 'username' => 'mem3', 'password' => \Hash::make('123456'), 'birthday' => '1990-11-11', 'role_id' => 3, 'address' => 'address address', 'phone' => '123456'], ['first_name' => '1', 'last_name' => '1', 'email' => '1@1.com', 'username' => 'mem4', 'password' => \Hash::make('123456'), 'birthday' => '1990-11-11', 'role_id' => 3, 'address' => 'address address', 'phone' => '123456'], ['first_name' => '1', 'last_name' => '1', 'email' => '1@1.com', 'username' => 'mem5', 'password' => \Hash::make('123456'), 'birthday' => '1990-11-11', 'role_id' => 3, 'address' => 'address address', 'phone' => '123456'], ['first_name' => '1', 'last_name' => '1', 'email' => '1@1.com', 'username' => 'a1', 'password' => \Hash::make('123456'), 'birthday' => '1990-11-11', 'role_id' => 3, 'address' => 'address address', 'phone' => '123456'], ['first_name' => '1', 'last_name' => '1', 'email' => '1@1.com', 'username' => 'a0', 'password' => \Hash::make('123456'), 'birthday' => '1990-11-11', 'role_id' => 3, 'address' => 'address address', 'phone' => '123456'], ['first_name' => '1', 'last_name' => '1', 'email' => '1@1.com', 'username' => 'a3', 'password' => \Hash::make('123456'), 'birthday' => '1990-11-11', 'role_id' => 3, 'address' => 'address address', 'phone' => '123456'], ['first_name' => '1', 'last_name' => '1', 'email' => '1@1.com', 'username' => 'liem1234', 'password' => \Hash::make('123456'), 'birthday' => '1990-11-11', 'role_id' => 3, 'address' => 'address address', 'phone' => '123456'], ['first_name' => '1', 'last_name' => '1', 'email' => '1@1.com', 'username' => 'test', 'password' => \Hash::make('123456'), 'birthday' => '1990-11-11', 'role_id' => 3, 'address' => 'address address', 'phone' => '123456'], ['first_name' => '1', 'last_name' => '1', 'email' => '1@1.com', 'username' => 'a', 'password' => \Hash::make('123456'), 'birthday' => '1990-11-11', 'role_id' => 3, 'address' => 'address address', 'phone' => '123456'], ['first_name' => '1', 'last_name' => '1', 'email' => '1@1.com', 'username' => 'liem12345', 'password' => \Hash::make('123456'), 'birthday' => '1990-11-11', 'role_id' => 3, 'address' => 'address address', 'phone' => '123456'], ['first_name' => '1', 'last_name' => '1', 'email' => '1@1.com', 'username' => 'thaithai', 'password' => \Hash::make('123456'), 'birthday' => '1990-11-11', 'role_id' => 3, 'address' => 'address address', 'phone' => '123456'], ['first_name' => '1', 'last_name' => '1', 'email' => '1@1.com', 'username' => 'thaihv', 'password' => \Hash::make('123456'), 'birthday' => '1990-11-11', 'role_id' => 3, 'address' => 'address address', 'phone' => '123456']];
User::insert($data);
// Fake data
// $faker = Faker\Factory::create();
// foreach (range(10,30) as $index) {
// User::create([
// 'first_name'=>$faker->name,
// 'last_name'=>$faker->name,
// 'username'=>$faker->name,
// 'password'=>Hash::make('123456'),
// 'email'=>$faker->email,
// 'role_id'=>3,
// ]);
// }
}
示例13: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$faker = Faker::create();
$user = new User();
$user->name = 'AdminMov';
$user->apellido_paterno = 'Ap admin';
$user->confirmado = 1;
$user->codigo_confirmacion = str_random();
$user->tipo_usuario = 'administrador';
$user->email = 'verificacion.mov.uach@gmail.com';
$user->avatar = 'avatar.jpg';
$user->password = 'movilidad321';
$user->save();
$samples_temp = [];
for ($i = 0; $i < 150; $i++) {
$samples_temp[] = ['name' => $faker->firstName, 'apellido_paterno' => $faker->lastName, 'confirmado' => $faker->numberBetween($min = 0, $max = 1), 'codigo_confirmacion' => str_random(), 'tipo_usuario' => 'usuario', 'email' => $faker->unique->email, 'avatar' => 'avatar.jpg', 'password' => bcrypt('secret')];
}
User::insert($samples_temp);
}
开发者ID:elNapoli,项目名称:iCnca7CrTNYXRF4oxPSidusv17MoVk7CEAhNGFGcYHSu0DNSy7Hkq,代码行数:24,代码来源:UserTableSeeder.php
示例14: simpansekolah
public function simpansekolah($request)
{
$nama = $request->input('nama');
$jenjang = $request->input('jenjang');
$alamat = $request->input('alamat');
$kota = $request->input('kota');
$provinsi = $request->input('provinsi');
$nomor_pokok = $request->input('nomor_pokok');
$username = $request->input('username');
$email = $request->input('email');
$password = $request->input('password');
$gambar = $request->file('gambar');
Users::insert(['username' => $username, 'display_name' => $nama, 'email' => $email, 'password' => bcrypt($password), 'role' => 'sekolah', 'confirmed' => true, 'confirmation_code' => md5(microtime() . env('APP_KEY'))]);
$id = Users::where('username', $username)->first()->id;
Schools::insert(['user_id' => $id, 'nama_sekolah' => $nama, 'jenjang' => $jenjang, 'alamat' => $alamat, 'kota' => $kota, 'provinsi' => $provinsi, 'nomor_pokok' => $nomor_pokok, 'created_at' => date('Y-m-d h:i:sa'), 'updated_at' => date('Y-m-d h:i:sa')]);
if ($gambar !== null) {
$filename = $id;
$upload_folder = '/img/sekolah/';
$gambar->move(public_path() . $upload_folder, $filename . '.jpg');
}
return redirect('auth/login');
}
示例15: StoreRegister
public function StoreRegister()
{
$date = date("d-m-Y H:i:s", strtotime('+3 hours'));
$user = User::where('username', Input::get('username'))->first();
$email = User::where('email', Input::get('email'))->first();
if (count($user) == 0 && count($email) == 0) {
if (Input::get('username') && Input::get('email') && Input::get('password') && filter_var(Input::get('email'), FILTER_VALIDATE_EMAIL)) {
User::insert(array('username' => Input::get('username'), 'email' => Input::get('email'), 'password' => Hash::make(Input::get('password')), 'date_registered' => $date));
return Response::json(['success' => 'request succeeded'], 200);
}
}
if (count($user) != 0 && count($email) != 0) {
return Response::json(['success' => 'request failed'], 406);
}
if (count($user) != 0) {
return Response::json(['success' => 'request failed'], 404);
}
if (count($email) != 0) {
return Response::json(['success' => 'request failed'], 405);
}
if (!filter_var(Input::get('email'), FILTER_VALIDATE_EMAIL)) {
return Response::json(['success' => 'request failed'], 400);
}
}