本文整理汇总了PHP中app\Profile::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Profile::create方法的具体用法?PHP Profile::create怎么用?PHP Profile::create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Profile
的用法示例。
在下文中一共展示了Profile::create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
\App\Profile::create(array('userid' => 1, 'about' => 'anurdha is great'));
\App\Profile::create(array('userid' => 2, 'about' => 'yeah is great'));
\App\Profile::create(array('userid' => 3, 'about' => 'ret is weak'));
\App\Profile::create(array('userid' => 4, 'about' => 'pep is beek'));
}
示例2: run
/**
* Run the Profiles table seeds.
*
* @return void
*/
public function run()
{
Eloquent::unguard();
Profile::create(['id' => 1, 'user_id' => 1, 'bio' => 'I like to soccer, women, and beer.', 'location' => 'Long Beach, CA', 'twitter_username' => 'johnsfeed', 'instagram_username' => 'johnwashere']);
Profile::create(['id' => 2, 'user_id' => 2, 'bio' => 'I like to cooking, reading, and swimming.', 'location' => 'Oceanside, CA', 'twitter_username' => 'karenwho', 'instagram_username' => 'karenthequeen']);
Profile::create(['id' => 3, 'user_id' => 3, 'bio' => 'I like eating raw food and yoga.', 'location' => 'San Francisco, CA', 'twitter_username' => 'janesworld', 'instagram_username' => 'janedidit']);
}
示例3: create
/**
* Create a new user and connected profile instance after a valid registration.
*
* @param array $data
* @return User
*/
protected function create(array $data)
{
$user = User::create(['username' => $data['username'], 'email' => $data['email'], 'password' => bcrypt($data['password'])]);
$profile = Profile::create(['user_id' => $user->id, 'picture' => "default-avatar.jpg"]);
$user->profile()->save($profile);
return $user;
}
示例4: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$this->validate($request, ['first_name' => 'required|alpha_num|max:20', 'last_name' => 'required|alpha_num|max:20', 'gender' => 'boolean', 'birthdate' => 'date']);
$profile = Profile::create(['first_name' => $request->first_name, 'last_name' => $request->last_name, 'gender' => $request->gender, 'birthdate' => $request->birthdate, 'user_id' => Auth::user()->id]);
$user = Auth::user();
alert()->overlay('Congrats!', 'You made your profile', 'success');
return view('profile.show', compact('profile', 'user'));
}
示例5: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$profile = Profile::create(['name' => $request->input('name'), 'bio' => $request->input('bio'), 'profile_image' => json_encode($request->input('profile_image')), 'type' => (int) $request->input('type'), 'status' => (int) $request->input('status')]);
if ($profile) {
return redirect('/admin/profile');
}
return back()->withInputs();
}
示例6: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$faker = \Faker\Factory::create();
foreach (range(1, 10) as $index) {
$user = User::All()->random(1);
Profile::create(['user_id' => $user->id, 'telephone' => $faker->phoneNumber, 'telegram' => $faker->username]);
}
}
示例7: run
public function run()
{
$faker = Faker\Factory::create();
Profile::truncate();
foreach (range(1, 20) as $index) {
Profile::create(['first_name' => $faker->firstName, 'last_name' => $faker->lastName, 'job' => $faker->word, 'motto' => $faker->sentence, 'about' => $faker->paragraph(4), 'favorite' => $faker->paragraph(4), 'favorite_img' => $faker->imageUrl(300, 200), 'sample_img1' => $faker->imageUrl(300, 200), 'sample_img2' => $faker->imageUrl(300, 200), 'sample_img3' => $faker->imageUrl(300, 200), 'location' => $faker->country, 'phone' => $faker->phoneNumber]);
}
}
示例8: create
/**
* Show the form for creating a new resource.
*
* @return Response
*/
public function create()
{
$customer = Auth::customer()->get();
if (!count($customer->profile)) {
$profile = Profile::create(['customer_id' => Auth::customer()->get()->id]);
}
return redirect()->route('profile.edit', $profile);
}
示例9: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('profiles')->insert(['user_id' => 1, 'first_name' => 'Uriah', 'last_name' => 'Galang', 'profile_pic' => '/img/avatar.png', 'about_me' => 'Im Your Admin', 'display_name' => 'Super Mario Bros.', 'contact_no' => '09277503043', 'address' => 'New Cabalan', 'city' => 'Olongapo', 'province_state' => 'Zambales', 'zip_code' => '2200', 'country' => 'Philippines', 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
$faker = Faker\Factory::create();
// Profile::truncate();
foreach (range(2, 51) as $index) {
Profile::create(['user_id' => $index, 'first_name' => $faker->firstName, 'last_name' => $faker->lastName, 'profile_pic' => $faker->imageUrl($width = 200, $height = 200), 'about_me' => $faker->paragraph(5), 'display_name' => $faker->name, 'contact_no' => $faker->phoneNumber, 'address' => $faker->streetAddress, 'city' => $faker->city, 'province_state' => $faker->state, 'zip_code' => $faker->postcode, 'country' => $faker->country, 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
}
}
示例10: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$this->validate($request, ['profile.pitch' => 'required', 'profile.position' => 'required', 'profile.gender' => 'required', 'profile.website' => 'required', 'profile.city' => 'required', 'profile.country' => 'required']);
$profile = Profile::create(['pitch' => $request->profile['pitch'], 'position' => $request->profile['position'], 'gender' => $request->profile['gender'], 'website' => $request->profile['website'], 'city' => $request->profile['city'], 'country' => $request->profile['country'], 'user_id' => Auth::user()->id]);
foreach ($request->skills as $skill) {
$profile->attributes()->save(Attribute::create(['name' => $skill['name'], 'content' => $skill['content'], 'profile_id' => $profile->id]));
}
return $profile;
}
示例11: SaveProfile
public function SaveProfile($request)
{
$this->request = $request->all();
$profile = $this->user->profiles()->save(Profile::create($this->request));
if (isset($this->request["client_id"])) {
$profile->clients()->attach($this->request["client_id"]);
}
return $profile;
}
示例12: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
// clear table
\App\Profile::truncate();
// add 1st row
\App\Profile::create(['user_id' => 1, 'firstname' => 'Хангал', 'lastname' => 'Жаргалсайхан', 'headline' => 'Оюутан', 'address' => 'БГД-н 4-р хороолол 45-20', 'desired_salary' => 800000, 'phone' => '89237842', 'summary' => 'Laravel Framework ашиглах болон, Full stack development хийх сонирхолтой']);
// add 2nd row
\App\Profile::create(['user_id' => 2, 'firstname' => 'Khangal', 'lastname' => 'Kola', 'headline' => 'Undergraduate', 'address' => 'New York', 'phone' => '12345678', 'summary' => 'I wanna be a rockstar.']);
}
示例13: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$this->validate($request, ['first_name' => 'required|alpha_num|max:20', 'last_name' => 'required|alpha_num|max:20', 'gender' => 'boolean', 'birthdate' => 'date']);
$profile = Profile::create(['first_name' => $request->first_name, 'last_name' => $request->last_name, 'gender' => $request->gender, 'birthdate' => $this->formatDatePickerDate($request->birthdate), 'user_id' => Auth::user()->id]);
$profile->save();
$user = User::where('id', '=', $profile->user_id)->first();
alert()->success('Congrats!', 'You made your profile');
return view('profile.show', compact('profile', 'user'));
}
示例14: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Model::unguard();
DB::table('profiles')->delete();
$users = User::all();
$faker = Faker::create();
foreach ($users as $user) {
Profile::create(['description' => $faker->sentence(), 'user_id' => $user->id]);
}
}
示例15: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Model::unguard();
$faker = \Faker\Factory::create();
foreach (range(1, 50) as $index) {
$user = \App\User::create(['username' => str_replace('.', ' ', $faker->username), 'email' => $faker->email, 'password' => bcrypt('password'), 'remember_token' => str_random(10)]);
\App\Profile::create(['user_id' => $user->id]);
}
Model::reguard();
}