当前位置: 首页>>代码示例>>PHP>>正文


PHP Profile::fill方法代码示例

本文整理汇总了PHP中app\models\Profile::fill方法的典型用法代码示例。如果您正苦于以下问题:PHP Profile::fill方法的具体用法?PHP Profile::fill怎么用?PHP Profile::fill使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\models\Profile的用法示例。


在下文中一共展示了Profile::fill方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: postCreate

 public function postCreate()
 {
     $postValue = $this->getProfileInput();
     $profile = new Profile();
     if ($profile->validate($postValue)) {
         $profile->fill($postValue);
         $profile->save();
         return redirect(route('home'));
     } else {
         return view('profile.create', compact('profile'));
     }
 }
开发者ID:juliardi,项目名称:jualjasa,代码行数:12,代码来源:ProfileController.php

示例2: createOrUpdateProfile

 public function createOrUpdateProfile($user, $data)
 {
     $profile = $user->profile;
     if (!$profile) {
         $profile = new Profile();
     }
     DB::beginTransaction();
     try {
         $profile->fill($data);
         if ($user->profile()->save($profile)) {
             DB::commit();
             return $user;
         } else {
             DB::rollback();
             return false;
         }
     } catch (Exception $ex) {
         DB::rollback();
         return false;
     }
 }
开发者ID:muhammadshakeel,项目名称:laravel-api-boilerplate-oauth,代码行数:21,代码来源:UserRepository.php

示例3: update

 /**
  * Update a user's profile
  *
  * @param $username
  * @return mixed
  * @throws Laracasts\Validation\FormValidationException
  */
 public function update($username, Request $request)
 {
     $user = $this->getUserByUsername($username);
     $input = Input::only('location', 'bio', 'twitter_username', 'github_username', 'career_title', 'education');
     $profile_validator = $this->profile_validator($request->all());
     if ($profile_validator->fails()) {
         $this->throwValidationException($request, $profile_validator);
         return redirect('profile/' . $user->name . '/edit')->withErrors($validator)->withInput();
     }
     if ($user->profile == null) {
         $profile = new Profile();
         $profile->fill($input);
         $user->profile()->save($profile);
     } else {
         $user->profile->fill($input)->save();
     }
     return redirect('profile/' . $user->name . '/edit')->with('status', 'Profile updated!');
 }
开发者ID:gabrieljaime,项目名称:Payroll-Laravel5,代码行数:25,代码来源:ProfilesController.php

示例4: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $create_new_validator = $this->create_new_validator($request->all());
     if ($create_new_validator->fails()) {
         $this->throwValidationException($request, $create_new_validator);
     } else {
         $activation_code = str_random(60) . $request->input('email');
         $user = new User();
         $user->email = $request->input('email');
         $user->name = $request->input('name');
         $user->first_name = $request->input('first_name');
         $user->last_name = $request->input('last_name');
         $userAccessLevel = $request->input('user_level');
         $user->password = bcrypt($request->input('password'));
         // GET ACTIVATION CODE
         $user->activation_code = $activation_code;
         $user->active = '1';
         // GET IP ADDRESS
         $userIpAddress = new CaptureIp();
         $user->admin_ip_address = $userIpAddress->getClientIp();
         // SAVE THE USER
         $user->save();
         // ADD ROLE
         $user->assignRole($userAccessLevel);
         // CREATE PROFILE LINK TO TABLE
         $profile = new Profile();
         $profileInputs = Input::only('location', 'bio', 'twitter_username', 'github_username');
         $profile->fill($profileInputs);
         $user->profile()->save($profile);
         // THE SUCCESSFUL RETURN
         return redirect('edit-users')->with('status', 'Successfully created user!');
     }
 }
开发者ID:jeremykenedy,项目名称:laravel-auth,代码行数:39,代码来源:UsersManagementController.php


注:本文中的app\models\Profile::fill方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。