本文整理汇总了PHP中Profile::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Profile::create方法的具体用法?PHP Profile::create怎么用?PHP Profile::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Profile
的用法示例。
在下文中一共展示了Profile::create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create
/**
* @param array $profileData
* @param array $applicationData OPTIONAL
* @param array $serverData OPTIONAL
*
* @return ProfileInterface
*/
public function create($profileData = array(), $applicationData = array(), $serverData = array())
{
$profile = Profile::create();
$profile->setProfileData($profileData);
$profile->setApplicationData($applicationData);
$profile->setServerData($serverData);
return $profile;
}
示例2: run
public function run()
{
//removes existing profiles from table
DB::table('profiles')->delete();
$faker = Faker::create();
foreach (range(1, 21) as $index) {
Profile::create(['first_name' => $faker->firstName, 'last_name' => $faker->lastName, 'user_id' => $faker->unique()->numberBetween(1, 21), 'location' => $faker->country()]);
}
}
示例3: store
/**
* Store a newly created profile in storage.
*
* @return Response
*/
public function store()
{
$validator = Validator::make($data = Input::all(), Profile::$rules);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
}
Profile::create($data);
return Redirect::route('profiles.index');
}
示例4: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\RedirectRespons
*/
public function store(Request $request)
{
$input = $request->all();
$input['password'] = Hash::make($input['password']);
$user = $this->users->create($input);
//create Blank profile
$profile = Profile::create(['user_id' => $user->id, 'bio' => '']);
$profile->save();
return \Redirect::route('admin.users.index', [])->withMessage(trans('acl::user.users-controller-successfully_created'));
}
示例5: run
public function run()
{
DB::table('profiles')->delete();
$users = User::all();
$i = 1;
foreach ($users as $user) {
Profile::create(array('id' => $i, 'user_id' => $user->user_id, 'follower_count' => 0, 'following_count' => 0, 'rate_count' => 0, 'comment_count' => 0, 'scan_count' => 0, 'country_id' => $i, 'image' => 'wines/' . $i . '.png', 'bio' => 'this is profile of user' . $i, 'last_name' => 'pro' . $i, 'first_name' => 'user'));
$i++;
}
}
示例6: run
public function run()
{
DB::table('users')->truncate();
DB::table('profiles')->truncate();
$faker = Faker\Factory::create();
$adminId = DB::table('users')->insertGetId(array('username' => 'admin', 'password' => Hash::make('admin'), 'email' => 'admin@saaspanel.org', 'confirmed' => true, 'role' => 'Admin', 'created_at' => new DateTime(), 'updated_at' => new DateTime()));
Profile::create(array('id' => $adminId, 'full_name' => $faker->name, 'address' => $faker->address, 'city' => $faker->city, 'country' => $faker->country, 'phone' => $faker->phoneNumber, 'company' => $faker->company));
$clientId = DB::table('users')->insertGetId(array('username' => 'client', 'password' => Hash::make('client'), 'email' => 'client@saaspanel.org', 'confirmed' => true, 'created_at' => new DateTime(), 'updated_at' => new DateTime()));
Profile::create(array('id' => $clientId, 'full_name' => $faker->name, 'address' => $faker->address, 'city' => $faker->city, 'country' => $faker->country, 'phone' => $faker->phoneNumber, 'company' => $faker->company));
for ($i = 1; $i <= 20; $i++) {
$user = DB::table('users')->insertGetId(array('username' => $faker->username, 'password' => Hash::make('test'), 'email' => $faker->email, 'confirmed' => true, 'created_at' => new DateTime(), 'updated_at' => new DateTime()));
Profile::create(array('id' => $user, 'full_name' => $faker->name, 'address' => $faker->address, 'city' => $faker->city, 'country' => $faker->country, 'phone' => $faker->phoneNumber, 'company' => $faker->company));
}
}
示例7: new_user
public static function new_user()
{
return function ($req, $res) {
$data = $req->data();
$user = $data->user;
$new_user = new User();
$new_user->username = $user->username;
$new_user->password = $user->password;
$new_user->save();
$profile = $data->profile;
$profile->id = $new_user->id;
$new_profile = Profile::create($profile);
//$res->json($new_profile->as_array());
$res->redirect('/login');
};
}
示例8: processSignUp
public function processSignUp()
{
$data = Input::all();
$validator = User::validate_registration($data);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput(Input::except('password', 'password_confirm'));
}
$code = str_random(32);
$user = User::create(['username' => $data['username'], 'email' => $data['email'], 'password' => Hash::make($data['password']), 'activation_code' => $code, 'activated' => 0]);
$user->assignMemberRole();
Throttle::create(['user_id' => $user->id]);
Profile::create(['user_id' => $user->id]);
$activation_link = URL::route('activate', $code);
//$user->email is out of scope for the mail closure, hence to access it, we have defined "use ($user)"
Mail::send('emails.users.activate', ['link' => $activation_link, 'username' => Input::get('username')], function ($message) use($user) {
$message->to($user->email, $user->username)->subject('Activate Your Account');
});
return Redirect::to('login')->withActivationMessage(Lang::get('larabase.signup_success'));
}
示例9: store
/**
* Store a newly created post in storage.
*
* @return Response
*/
public function store()
{
$validator = Validator::make($data = Input::all(), User::$rules);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
}
// var_dump($data);die;
$user['fname'] = $data['fname'];
$user['lname'] = $data['lname'];
$user['email'] = $data['email'];
$user['role'] = 3;
$user['password'] = Hash::make($data['password']);
$userObj = new User();
$userSave = $userObj->create($user);
$profile['user_id'] = $userSave->id;
$profile['gender'] = $data['gender'];
$profile['postal_code'] = $data['postal_code'];
$profile['profile_name'] = $data['profile_name'];
$profileObj = new Profile();
$profileSave = $profileObj->create($profile);
return Redirect::to('/')->with('message', 'Signed up succesflly');
}
示例10: elseif
} elseif (isset($_POST['btnPrimary']) && $check) {
new NotifyWidgetFailure(_T("You must specify a group name", "dyngroup"));
}
} else {
if ($id) {
$group = getPGobject($id, true);
$group->setVisibility($visible);
$group->setName($name);
$gid = $id;
} else {
if ($is_group) {
$group = new Group();
} else {
$group = new Profile();
}
$gid = $group->create($name, $visible);
if (!$is_group) {
$group->setImagingServer($imaging_server);
}
}
$request = $r->toS();
if ($save_type == 1) {
// request save
$group->setRequest($request);
$group->setBool($bool);
} else {
// result save
$group->setRequest($request);
$group->setBool($bool);
$group->reload();
if ($group->type == 1) {
示例11: complete_store
public function complete_store()
{
$rules = array('password' => 'required|min:6|confirmed', 'password_confirmation' => 'required|min:6');
$validator = Validator::make($data = Input::all(), $rules);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
}
$final_data = Session::get('data');
$data = array_merge($final_data, $data);
$user_name = explode(' ', $data['full_name']);
$data['fname'] = isset($user_name[0]) ? $user_name[0] : '';
$data['lname'] = isset($user_name[1]) ? $user_name[1] : '';
$plain_password = $data['password'];
$data['password'] = Hash::make($data['password']);
$user = User::create($data);
$user->role = 2;
$venu = Venue::create($data);
$profile = Profile::create($data);
$data['name'] = $data['business_name'];
unset($data['business_name']);
$business = Business::create($data);
$business->user_id = $user->id;
$profile->user_id = $user->id;
$venu->business_id = $business->id;
$user->save();
$business->save();
$profile->save();
$venu->save();
$where = array("email" => $user->email, 'password' => $plain_password);
if (Auth::attempt($where)) {
return Redirect::to('/business/dashboard/')->with('message', 'Successfully Login!');
}
return Redirect::to('/')->with('message', 'Signed up succesflly');
}
示例12: foreach
$listN[$member['uuid'] . '##' . $member['hostname']] = $member;
}
foreach ($listOfCurMembers as $member) {
$listC[$member['uuid'] . '##' . $member['hostname']] = $member;
}
$newmem = array_diff_assoc($listN, $listC);
$delmem = array_diff_assoc($listC, $listN);
if ($group->id) {
$group->setName($name);
if ($visibility == 'show') {
$group->show();
} else {
$group->hide();
}
} else {
$group->create($name, $visibility == 'show');
if ($type == 1) {
$group->setImagingServer($imaging_server);
}
}
$ret_add = $group->addMembers($newmem);
$res = $group->delMembers($delmem) && $ret_add[0];
if ($res) {
if ($already_exists) {
if ($type == 0) {
new NotifyWidgetSuccess(_T("Group successfully modified", "dyngroup"));
} else {
new NotifyWidgetSuccess(_T("Profile successfully modified", "dyngroup"));
}
} else {
if ($type == 0) {
示例13: testNull
public function testNull()
{
TipyModel::transaction(function () {
$profile = Profile::create(['userId' => 1, 'sign' => null]);
$this->assertNull($profile->sign);
$profile->sign = 'sign';
$profile->save();
$this->assertNotNull($profile->sign);
$profile->sign = null;
$profile->save();
$this->assertNull($profile->sign);
TipyModel::rollback();
});
}
示例14: function
$app->get('/show/:id', function ($id) use($app) {
$results = [];
$results["profile"] = Profile::find($id);
$results["success"] = "true";
echo json_encode($results);
});
$app->post('/form', function () use($app) {
$data = json_decode($app->request->getBody(), true);
$results = [];
$results["success"] = "false";
if (validatedKey($data['user'])) {
if (isset($data['profile']['id'])) {
Profile::find($data['profile']['id'])->update($data['profile']);
$results["value"] = "Update";
} else {
Profile::create($data['profile']);
$results["value"] = "New";
}
$results["success"] = "true";
} else {
$results["success"] = "false";
$results["error"] = "No auth";
}
echo json_encode($results);
});
$app->post('/delete', function () use($app) {
$data = json_decode($app->request->getBody(), true);
$results = [];
$results["success"] = "false";
if (validatedKey($data['user'])) {
$personal = Profile::find($data['personal']['id']);
示例15: testSetIdentifier
/**
* Tests the setIdentifier works with getter
*/
public function testSetIdentifier()
{
$profile = Profile::create();
$profile->setIdentifier('foo');
$this->assertEquals('foo', $profile->getIdentifier());
}