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


PHP Self::saveImage方法代码示例

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


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

示例1: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $validator = \Validator::make(\Input::all(), array('name' => 'required', 'surname' => 'required', 'email' => 'required|email|unique:users', 'password' => 'required|confirmed|min:6', 'permission_group_id' => 'required|integer', 'dob' => 'date', 'language' => 'required'));
     if ($validator->fails()) {
         return \Redirect::back()->withInput()->withErrors($validator);
     }
     $user = User::create(array('name' => \Input::get('name'), 'surname' => \Input::get('surname'), 'email' => \Input::get('email'), 'permission_group_id' => \Input::get('permission_group_id'), 'password' => \Hash::make(\Input::get('password')), 'dob' => \Input::get('dob'), 'language' => \Input::get('language')));
     //upload of user image
     if (\Input::has('img_url')) {
         Self::saveImage(\Input::get('img_url'), $user, true);
     }
     return \Redirect::route('user.index');
 }
开发者ID:iget-master,项目名称:material-admin,代码行数:18,代码来源:UserController.php

示例2: update

 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $user = User::findOrFail($id);
     $validator = \Validator::make(\Input::all(), array('name' => 'required', 'surname' => 'required', 'password' => 'confirmed|min:6', 'permission_group_id' => 'required|integer', 'dob' => 'date', 'language' => 'required'));
     if ($validator->fails()) {
         return \Redirect::back()->withInput()->withErrors($validator);
     }
     $user->name = \Input::get('name');
     $user->surname = \Input::get('surname');
     $user->permission_group_id = \Input::get('permission_group_id');
     $user->dob = \Input::get('dob');
     $user->language = \Input::get('language');
     if (strlen(\Input::get('password'))) {
         $user->password = \Hash::make(\Input::get('password'));
     }
     //upload of user image
     if (\Input::has('img_url')) {
         Self::saveImage(\Input::get('img_url'), $user, false);
     }
     $user->save();
     $messages = with(new MessageBag())->add('success', 'Usuário modificado com sucesso!');
     return \Redirect::route('user.index')->with('messages', $messages);
 }
开发者ID:hramose,项目名称:material-admin,代码行数:29,代码来源:UserController.php


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