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


PHP UserRequest::hasFile方法代码示例

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


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

示例1: update

 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  User $user
  * @return \Illuminate\Http\Response
  */
 public function update(UserRequest $request, User $user)
 {
     $user->update($request->only(['name', 'occupation', 'bio', 'email']));
     $files_id[] = $request->hasFile('photo') ? $this->uploadFile($user, $request->file('photo'), 'profile_photo') : $request->input('photo_id');
     $files_id[] = $request->hasFile('cover') ? $this->uploadFile($user, $request->file('cover'), 'profile_cover') : $request->input('cover_id');
     $user->files()->sync($files_id);
     session()->flash('flash_message', 'Se han actualizado los datos de perfil');
     return redirect('admin/settings?tab=profile');
 }
开发者ID:realnerdo,项目名称:blog,代码行数:16,代码来源:UsersController.php

示例2: postUpdate

 /**
  * Update profile
  *
  * @return Response
  */
 public function postUpdate(\App\Http\Requests\UserRequest $request)
 {
     $user_id = $this->auth->user()->id;
     $this->user->updateProfile($user_id, $request->all());
     if ($request->hasFile('avatar')) {
         $this->user->updateAvatar($user_id, $request->file('avatar'));
     }
     if ($request->hasFile('cover')) {
         $this->user->updateCover($user_id, $request->file('cover'));
     }
     return redirect()->action('UserController@getUpdate')->with('flash_message', trans('user.update_success'));
 }
开发者ID:hlmasterchief,项目名称:plock,代码行数:17,代码来源:UserController.php

示例3: atualiza

 public function atualiza(UserRequest $request)
 {
     $id = Auth::user()->id;
     $user = User::find($id);
     $user->name = $request->nome;
     // Verifica se usuário deseja alterar a foto
     if ($request->hasFile('foto')) {
         $user->photo = '/' . $request->file('foto')->move('img/uploads/users');
     }
     // Verifica a senha antiga
     if (Hash::check($request->senhaAntiga, Auth::user()->password)) {
         $user->password = Hash::make($request->senhaNova);
         $user->save();
         Auth::logout();
         return redirect()->action('HomeController@index');
     }
     $user->save();
     return redirect()->action('UserController@edita');
 }
开发者ID:allancarlos123,项目名称:estoque_laravel,代码行数:19,代码来源:UserController.php

示例4: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(UserRequest $request)
 {
     $user = new User();
     $user->name = $request->name;
     $user->gender = $request->gender;
     $user->email = $request->email;
     $user->phone = $request->phone;
     $user->username = $request->username;
     $user->address = $request->address;
     $user->designation = $request->designation;
     if ($request->default_password) {
         $user->password = Hash::make(User::DEFAULT_PASSWORD);
     } else {
         $user->password = Hash::make($request->password);
     }
     if ($request->hasFile('photo')) {
         $user->image = $this->imageModifier($request, $request->all()['photo']);
     }
     $user->save();
     return redirect('user')->with('message', 'User created successfully.');
 }
开发者ID:echiteri,项目名称:iBLIS,代码行数:26,代码来源:UserController.php

示例5: postUpdate

 public function postUpdate(UserRequest $request)
 {
     $user = $this->user->findById(Auth::user()->id);
     $user->name = $request->input('name');
     $user->fio = $request->input('fio');
     $user->phone_number = $request->input('phone');
     $user->address = $request->input('address');
     $user->birth = $request->input('birth');
     $user->get_news = $request->input('get_news');
     $user->email = $request->input('email');
     if ($request->hasFile('photo')) {
         try {
             $image = Image::make($request->file('photo'));
             //  check the directories
             if (!File::exists($this->saveImgDir)) {
                 File::makeDirectory($this->saveImgDir);
             }
             if (!File::exists($this->saveImgDir . '/avatars')) {
                 File::makeDirectory($this->saveImgDir . '/avatars');
             }
             if (!File::exists($this->saveImgDir . '/avatars/' . $user->id)) {
                 File::makeDirectory($this->saveImgDir . '/avatars/' . $user->id);
             }
             // dir to save image
             $dir = $this->saveImgDir . '/avatars/' . $user->id;
             if (!File::exists($dir)) {
                 File::makeDirectory($dir);
             }
             // save medium
             $image->fit(240, 240)->save($dir . '/avatar.jpg');
             $user->photo = $dir . '/avatar.jpg';
         } catch (Exception $e) {
             dd($e);
         }
     } else {
         dd(56);
     }
     $user->save();
     return view('user.profile')->withUser($user);
 }
开发者ID:peshkov3,项目名称:mircurius,代码行数:40,代码来源:UserController.php

示例6: update

 public function update(UserRequest $request, $id)
 {
     if ($this->currentUser->hasAccess('wts.user.edit')) {
         DB::transaction(function () use($request) {
             // Update the user
             $user = Sentry::findUserById(Crypt::decrypt($request->id));
             if ($request->has('send_sms') && $request->send_sms == 1) {
                 if ($request->has('password')) {
                     $user->password = $request->password;
                     CommonController::sendSms('RHPOZTFYAY', $user->phone, 'Merhaba  "' . $user->first_name . ' ' . $user->last_name . '" WTS iş takip sistemi için; \\nEmailiniz : ' . $request->email . ' \\nŞifreniz: ' . $request->password . '\\nGüvenliğiniz açısından şifrenizi kimseyle paylaşmamanızı ve en kısa sürede değiştirmenizi önermekteyiz.\\nSite: wts.pinnacle.com.tr');
                 } else {
                     CommonController::sendSms('RHPOZTFYAY', $user->phone, 'Merhaba  "' . $user->first_name . ' ' . $user->last_name . '" WTS iş takip sistemi için; \\nEmailiniz : ' . $request->email . '\\nGüvenliğiniz açısından emailinizi kimseyle paylaşmamanızı ve şifrenizi düzenli aralıklarla değiştirmenizi önermekteyiz.\\nSite: wts.pinnacle.com.tr');
                 }
             }
             $user->email = $request->email;
             $user->first_name = $request->first_name;
             $user->last_name = $request->last_name;
             $user->phone = $request->phone;
             $user->slug = $request->slug_name;
             $user->save();
             // Find the group using the group id
             $groupId = Crypt::decrypt($request->group);
             if ($user->getGroups()[0]->id != $groupId) {
                 $newGroup = Sentry::findGroupById($groupId);
                 $user->updateGroups($newGroup);
             }
             if ($request->image_hidden) {
                 $file_path = public_path() . "/uploads/profile-images/" . $user->image;
                 \File::delete($file_path);
             }
             if ($request->hasFile('image')) {
                 $file = $request->file('image');
                 $imageName = CommonController::imageUpload($file, 'uploads/profile-images');
                 $user->image = $imageName;
                 $user->save();
             }
         });
         return response()->json($this->editResponseMessage);
     } else {
         abort(403, $this->accessForbidden);
     }
 }
开发者ID:pinnaclesoftware,项目名称:Work-Tracking-System,代码行数:42,代码来源:UserController.php

示例7: update

 public function update(UserRequest $request, $id)
 {
     $data = $request->all();
     $model = Users::find($id);
     autoAssignDataToProperty($model, $request->all());
     if ($request->hasFile('avatar')) {
         $file = $request->file('avatar');
         $name = $file->getClientOriginalName();
         $extension = $file->getClientOriginalExtension();
         $picture = time() . $name . '.' . $extension;
         $request->file('avatar')->move('images/avatar', $picture);
         $filename = 'images/avatar/' . $picture;
     } else {
         $image = $model->toArray();
         $filename = $image['avatar'];
     }
     $password = bcrypt($request->input('password'));
     $model->password = $password;
     $model->avatar = $filename;
     $model->save();
     return redirect()->action('Admin\\UsersController@index')->withSuccess(Lang::get('messages.update_success'));
 }
开发者ID:dhduc,项目名称:shopui,代码行数:22,代码来源:UsersController.php

示例8: updateProfile

 public function updateProfile(UserRequest $request, Guard $auth)
 {
     $pathUser = 'profile_picture';
     \Storage::makeDirectory($pathUser);
     $user = User::findOrFail($auth->id());
     $user->fill($request->all());
     if ($request->hasFile('avatar')) {
         $Documento = $request->file('avatar');
         $nombre = \Hash::make($Documento->getClientOriginalName());
         $nombre = str_replace('/', 'Y', $nombre);
         $nombre = $nombre . '.' . $Documento->guessExtension();
         $fullPath = $pathUser . '/' . $nombre;
         \Storage::disk('local')->put($fullPath, \File::get($Documento));
         $user->avatar = 'documentos/' . $fullPath;
     } else {
         if ($request->get('delImgProfile') === 'true') {
             $user->avatar = 'avatar.jpg';
         }
     }
     $user->save();
     return redirect('home');
 }
开发者ID:elNapoli,项目名称:iCnca7CrTNYXRF4oxPSidusv17MoVk7CEAhNGFGcYHSu0DNSy7Hkq,代码行数:22,代码来源:UsuariosController.php


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