/** * Store a newly created resource in storage. * * @param AdduserRequest $request * @return \Illuminate\Http\Response */ public function store(AdduserRequest $request) { // $input = $request->all(); // get all data // $input['confirmed'] = 1; // set confirmed to 1 // $input['password'] = Hash::make($input['password']); // hash password // // $user = User::create($input); // save above details $user = User::create(['first_name' => $request->first_name, 'last_name' => $request->last_name, 'email' => $request->email, 'confirmed' => 1, 'password' => Hash::make($request->password)]); // $profile = $user->profile()->save(new Profile); // also create new profile // $profile->apartment_id = Auth::user()->profile->defaultApartment; // get current defaultApartment // $profile->save(); // save details on profile $profile = Profile::create(['user_id' => $user->id, 'apartment_id' => Auth::user()->profile->defaultApartment]); dd(Auth::user()->profile->defaultApartment); $role = Role::whereName('user')->first(); $user->assignRole($role); //Assign Role $block_no = $request->blockno; // get block_no from profileform $floor_no = $request->floorno; // get floor_no from profileform $profile->apartments()->attach($profile->defaultApartment, ['approved' => '1', 'block_no' => $block_no, 'floor_no' => $floor_no]); // attach this profile with default apartment, with approved = 1, and block_no, floor_no according to profileform in apartment_profile pivot table. Crm_account::create(['account' => $user->first_name . $user->last_name, 'fname' => $user->first_name, 'lname' => $user->last_name, 'company' => 'Company Name', 'email' => $user->email, 'address' => 'Current Address', 'city' => 'Nagpur', 'state' => 'Maharashtra', 'zip' => '440012', 'country' => 'India']); return redirect()->back()->withMessage('User has been Added')->withStatus('success'); }
/** * Run the database seeds. * * @return void */ public function run() { DB::statement("SET foreign_key_checks = 0"); Profile::truncate(); Profile::create(array('user_id' => '1', 'defaultApartment' => '1', 'gender' => 'Male', 'mobile_no' => '8600012345', 'verified' => '1')); Profile::create(array('user_id' => '2', 'defaultApartment' => '1', 'gender' => 'Male', 'mobile_no' => '8600012345', 'verified' => '1')); }
/** * Create new account * * @param Request $request * @return Response */ public function postUser(Request $request) { if (!$this->appKeyAvailable($request)) { return $this->notAuthorized($request); } $validator = Validator::make($request->all(), ['username' => 'required|unique:users,username|min:4|max:32', 'email' => 'required|unique:users,email|max:32|email', 'password' => 'required|min:6']); if ($validator->fails()) { $this->setResultError($validator->messages(), 400); } else { $user = $request->all(); $user['password'] = Hash::make($user['password']); $this->user = User::create($user); if (isset($user['profile'])) { if (is_array($user['profile'])) { foreach ($user['profile'] as $key => $value) { Profile::create(['key' => $key, 'value' => $value, 'user_id' => $this->user->id]); } } } $this->setResultOk(); $this->setSessionHash(); $this->setUserData(); } return $this->setResponse(); }
public function run() { $faker = Faker::create('en_US'); /* * Base User Accounts */ // Mike's account $michael = User::create(['name' => 'Michael Norris', 'email' => '*****@*****.**', 'password' => bcrypt('password'), 'must_reset_password' => false, 'verify_token' => null, 'verified_on' => Carbon::now(), 'active_on' => Carbon::now(), 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()]); $michaelProfile = Profile::create(['user_id' => $michael->id, 'username' => 'mstnorris', 'salutation' => 'Mr', 'first_name' => 'Michael', 'middle_name' => 'Stephen Thomas', 'last_name' => 'Norris', 'nick_name' => 'Mike', 'date_of_birth' => '1988-08-17', 'address_line_1' => '78A Sackville Road', 'address_line_2' => '', 'address_line_3' => '', 'address_line_4' => '', 'address_city' => 'Hove', 'address_county' => 'East Sussex', 'address_postcode' => 'BN3 3HB', 'private_email_address' => '*****@*****.**', 'mobile_number' => '+44 (0) 7446 990 061', 'twitter_username' => 'mstnorris', 'facebook_username' => 'mstnorris', 'google_plus_username' => 'mstnorris', 'instagram_username' => 'mstnorris', 'profile_photo_url' => '/images/mike.jpg', 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()]); $michael->profile()->save($michaelProfile); // Sezer's account $sezer = User::create(['name' => 'Sezer Tunca', 'email' => '*****@*****.**', 'password' => bcrypt('password'), 'must_reset_password' => false, 'verify_token' => null, 'verified_on' => Carbon::now(), 'active_on' => Carbon::now(), 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()]); $sezerProfile = Profile::create(['user_id' => $sezer->id, 'username' => 'sezertunca', 'salutation' => 'Mr', 'first_name' => 'Sezer', 'middle_name' => '', 'last_name' => 'Tunca', 'nick_name' => 'Sezer', 'date_of_birth' => '1989-05-02', 'address_line_1' => 'Flat 4', 'address_line_2' => '15 Burlington Street', 'address_line_3' => '', 'address_line_4' => '', 'address_city' => 'Brighton', 'address_county' => 'East Sussex', 'address_postcode' => 'BN2 1AA', 'private_email_address' => '*****@*****.**', 'mobile_number' => '+44 (0) 7545 278 156', 'twitter_username' => 'sezertunca', 'facebook_username' => 'sezertunca', 'google_plus_username' => 'sezertunca', 'instagram_username' => 'sezertunca', 'profile_photo_url' => '/images/sezer.jpg', 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()]); $sezer->profile()->save($sezerProfile); // Holly's account $holly = User::create(['name' => 'Holly McNicol', 'email' => '*****@*****.**', 'password' => bcrypt('password'), 'must_reset_password' => false, 'verify_token' => null, 'verified_on' => Carbon::now(), 'active_on' => Carbon::now(), 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()]); $hollyProfile = Profile::create(['user_id' => $holly->id, 'username' => 'hjmcnicol', 'salutation' => 'Miss', 'first_name' => 'Holly', 'middle_name' => 'Jane', 'last_name' => 'McNicol', 'nick_name' => 'Holly', 'date_of_birth' => '1990-05-16', 'address_line_1' => '78A Sackville Road', 'address_line_2' => '', 'address_line_3' => '', 'address_line_4' => '', 'address_city' => 'Hove', 'address_county' => 'East Sussex', 'address_postcode' => 'BN3 3HB', 'private_email_address' => '*****@*****.**', 'mobile_number' => '+44 (0) 7950 994 570', 'twitter_username' => 'hjmcnicol', 'facebook_username' => 'hjmcnicol', 'google_plus_username' => 'hjmcnicol', 'instagram_username' => 'hjmcnicol', 'profile_photo_url' => '/images/holly.jpg', 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()]); $holly->profile()->save($hollyProfile); // Jane's account $jane = User::create(['name' => 'Jane Challenger-Gillitt', 'email' => '*****@*****.**', 'password' => bcrypt('password'), 'must_reset_password' => false, 'verify_token' => null, 'verified_on' => Carbon::now(), 'active_on' => Carbon::now(), 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()]); $janeProfile = Profile::create(['user_id' => $jane->id, 'username' => 'jmchallengergillitt', 'salutation' => 'Mrs', 'first_name' => 'Jane', 'middle_name' => '', 'last_name' => 'Challenger-Gillitt', 'nick_name' => 'Jane', 'date_of_birth' => '1980-01-01', 'address_line_1' => '1 Hove Road', 'address_line_2' => '', 'address_line_3' => '', 'address_line_4' => '', 'address_city' => 'Hove', 'address_county' => 'East Sussex', 'address_postcode' => 'BN3 3BN', 'private_email_address' => '*****@*****.**', 'mobile_number' => '+44 (0) 7987 654 321', 'twitter_username' => 'jmchallengergillitt', 'facebook_username' => 'jmchallengergillitt', 'google_plus_username' => 'jmchallengergillitt', 'instagram_username' => 'jmchallengergillitt', 'profile_photo_url' => 'https://placeholdit.imgix.net/~text?txt=JCG&txtsize=80&bg=eceff1&txtclr=607d8b&w=640&h=640', 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()]); $jane->profile()->save($janeProfile); // Super Administrator (User) $superU = User::create(['name' => 'Super Administrator', 'email' => '*****@*****.**', 'password' => bcrypt('password'), 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()]); $superUProfile = Profile::create(['user_id' => $superU->id, 'username' => 'superadmin', 'salutation' => 'Mr', 'first_name' => 'Super', 'middle_name' => '', 'last_name' => 'Administrator', 'nick_name' => 'SuperAdmin', 'date_of_birth' => '1980-01-01', 'address_line_1' => 'Address line 1', 'address_line_2' => '', 'address_line_3' => '', 'address_line_4' => '', 'address_city' => 'Hove', 'address_county' => 'East Sussex', 'address_postcode' => 'BN3 3HB', 'private_email_address' => '*****@*****.**', 'mobile_number' => '+44 (0) 7950 994 570', 'twitter_username' => 'superadmin', 'facebook_username' => 'superadmin', 'google_plus_username' => 'superadmin', 'instagram_username' => 'superadmin', 'profile_photo_url' => 'https://placeholdit.imgix.net/~text?txt=SUP&txtsize=80&bg=eceff1&txtclr=607d8b&w=640&h=640', 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()]); $superU->profile()->save($superUProfile); // Administrator (User) $adminU = User::create(['name' => 'Administrator', 'email' => '*****@*****.**', 'password' => bcrypt('password'), 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()]); $adminUProfile = Profile::create(['user_id' => $adminU->id, 'username' => 'admin', 'salutation' => 'Mr', 'first_name' => 'Admin', 'middle_name' => '', 'last_name' => 'Istrator', 'nick_name' => 'Admin', 'date_of_birth' => '1990-05-16', 'address_line_1' => '78A Sackville Road', 'address_line_2' => '', 'address_line_3' => '', 'address_line_4' => '', 'address_city' => 'Hove', 'address_county' => 'East Sussex', 'address_postcode' => 'BN3 3HB', 'private_email_address' => '*****@*****.**', 'mobile_number' => '+44 (0) 7950 994 570', 'twitter_username' => 'admin', 'facebook_username' => 'admin', 'google_plus_username' => 'admin', 'instagram_username' => 'admin', 'profile_photo_url' => 'https://placeholdit.imgix.net/~text?txt=ADM&txtsize=90&bg=eceff1&txtclr=607d8b&w=640&h=640', 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()]); $adminU->profile()->save($adminUProfile); // Super Administrator (Role) $superR = Role::create(['name' => 'super-admin', 'label' => 'Super Administrator']); // Administrator (Role) $adminR = Role::create(['name' => 'admin', 'label' => 'Administrator']); // Student (Role) $studentR = Role::create(['name' => 'student', 'label' => 'Student']); //create 20 users foreach (range(1, 20) as $index) { $user_wbid = str_random(16); $user_updated_at = $faker->dateTimeBetween($startDate = '-6 months', $endDate = 'now'); $user_created_at = $faker->dateTimeBetween($startDate = '-2 years', $endDate = $user_updated_at); $user_name = $faker->firstName; $user_username = strtolower($user_name . $faker->lastName); $user_email = $user_username . $faker->companyEmail; $user_dob = $faker->dateTimeBetween($startDate = '-25 years', $endDate = '-18 years'); $user = User::create(['wbid' => $user_wbid, 'name' => $user_name, 'dob' => $user_dob, 'email' => $user_email, 'username' => $user_username, 'password' => bcrypt('password'), 'key' => str_random(11), 'confirmed' => $faker->boolean(), 'created_at' => $user_created_at, 'updated_at' => $user_updated_at]); $user->roles()->attach($studentR); } $michael->roles()->attach($studentR); $sezer->roles()->attach($studentR); $holly->roles()->attach($studentR); $superU->roles()->attach($superR); $adminU->roles()->attach($adminR); $michael->roles()->attach($superR); $sezer->roles()->attach($superR); $michael->roles()->attach($adminR); $sezer->roles()->attach($adminR); $jane->roles()->attach($adminR); }
public function run() { DB::table('profile')->delete(); ProfileModel::create(['name' => 'Robert', 'surname' => 'Lippert', 'email' => '*****@*****.**', 'phone' => '123123']); ProfileModel::create(['name' => 'Andreas', 'surname' => 'Rudat', 'email' => '*****@*****.**', 'phone' => '123123']); ProfileModel::create(['name' => 'Christopher', 'surname' => 'Stock', 'email' => '*****@*****.**', 'phone' => '123123']); ProfileModel::create(['name' => 'Andreas', 'surname' => 'Zeissner', 'email' => '*****@*****.**', 'phone' => '123123']); }
/** * Run the database seeds. * * @return void */ public function run() { DB::table('profiles')->delete(); $users = User::all(); foreach ($users as $user) { Profile::create(['display_name' => 'The Real Doodle Maestro', 'user_id' => $user->id]); } }
public function run() { $faker = Faker::create(); $admin = User::create(['id' => 1, 'first_name' => 'Phillip', 'last_name' => 'Madsen', 'email' => '*****@*****.**', 'password' => bcrypt('mad15696'), 'last_login' => Carbon::now(), 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()]); $adminProfile = Profile::create(['user_ id' => 1, 'username' => 'phillipmadsen', 'facebook_username' => 'phillipmadsen', 'twitter_username' => 'phillipmadsen', 'instagram_username' => 'phillipmadsen']); $admin->profile()->save($adminProfile); $phillip = User::create(['id' => 2, 'first_name' => 'Phillip', 'last_name' => 'Madsen', 'email' => '*****@*****.**', 'password' => bcrypt('mad15696'), 'last_login' => Carbon::now(), 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()]); $phillipProfile = Profile::create(['user_ id' => 2, 'username' => 'phillipmadsen', 'facebook_username' => 'phillipmadsen', 'twitter_username' => 'phillipmadsen', 'instagram_username' => 'phillipmadsen']); $phillip->profile()->save($phillipProfile); }
public function run() { $faker = Faker::create(); $users = App\Models\User::all()->lists('id')->toArray(); $userIds = App\Models\User::lists('id'); foreach (range(1, 20) as $index) { $firstname = $faker->firstname; $lastname = $faker->lastname; $username = str_replace('.', '_', $faker->unique()->userName); $profile = Profile::create(['user_id' => $faker->randomElement($userIds), 'confirmed' => $faker->boolean($chanceOfGettingTrue = 50), 'is_active' => $faker->boolean($chanceOfGettingTrue = 50), 'is_fake' => true, 'activated' => $faker->boolean($chanceOfGettingTrue = 50), 'published' => $faker->boolean($chanceOfGettingTrue = 50), 'is_active' => $faker->boolean($chanceOfGettingTrue = 50), 'is_employee' => $faker->boolean($chanceOfGettingTrue = 50), 'is_public' => $faker->boolean($chanceOfGettingTrue = 50), 'website' => $faker->domainName, 'company' => $faker->company, 'uuid' => $faker->uuid, 'facebook_username' => $username . '_facebook', 'twitter_username' => $username . '_twitter', 'instagram_username' => $username . '_instagram', 'githubid' => $username . '_github', 'skypeid' => $username . '_skype', 'linkedinurl' => 'http://www.linkedin.com', 'googleplusurl' => 'http://plus.google.com', 'facebookurl' => 'http://www.facebook.com', 'birth_date' => $faker->date($format = 'm-d-Y', $max = 'now'), 'dob_month' => $faker->numberBetween($min = 1, $max = 12), 'dob_day' => $faker->numberBetween($min = 1, $max = 30), 'dob_year' => $faker->numberBetween($min = 1980, $max = 2010), 'pic' => $faker->imageUrl(600, 600, 'people', true, 'Faker'), 'username' => $username, 'display_name' => $firstname . " " . $lastname, 'about_me' => $faker->paragraph($nbSentences = 3), 'phone' => $faker->phoneNumber, 'phone_type' => 'Home', 'position' => 'employee', 'supervisor' => 'jaren', 'employment_title' => 'random employee', 'employment_role' => 'to follow nathan around the office', 'employment_status' => 'active', 'gender' => $faker->randomElement($array = ['Male', 'Female']), 'note' => $faker->bs, 'user_api_key' => str_random(32), 'user_api_secret' => str_random(64), 'user_activation_key' => str_random(128), 'activation_code_id' => str_random(128), 'activation_code' => str_random(15), 'confirmation_code' => str_random(4), 'profile_activated_on' => $faker->dateTimeBetween($startDate = '-2 years', $endDate = 'now'), 'published_on' => $faker->dateTimeBetween($startDate = '-2 years', $endDate = 'now'), 'slug' => $faker->slug, 'created_at' => Carbon\Carbon::now(), 'updated_at' => Carbon\Carbon::now()]); } }