當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。