本文整理汇总了PHP中app\User::fill方法的典型用法代码示例。如果您正苦于以下问题:PHP User::fill方法的具体用法?PHP User::fill怎么用?PHP User::fill使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\User
的用法示例。
在下文中一共展示了User::fill方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postProfile
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function postProfile(Request $request)
{
$inputs = $request->only('name', 'email');
$validator = $this->validatorForProfile($inputs);
if ($validator->fails()) {
$this->throwValidationException($request, $validator);
}
if ($this->user->fill($inputs)->save()) {
session()->flash('success', 'Your profile is updated.');
return redirect('dashboard');
}
session()->flash('error', 'Error occured to update your profile!');
return back();
}
示例2: store
public function store($request)
{
$user = new User();
$user->fill($request);
$user->save();
return $user;
}
示例3: register
public static function register(array $data)
{
// Fake when saving data
$user = new User();
$user->fill(['name' => trim($data['name']), 'email' => filter_var($data['email'], FILTER_SANITIZE_EMAIL), 'password' => $data['password']]);
return $user;
}
示例4: update
/**
* Update the specified user in storage.
*
* @param User $user
* @param UserRequest $request
* @return Response
*/
public function update(User $user, UserRequest $request)
{
$data = $this->storeImage($request, 'picture');
$user->fill($data);
$user->save() == true ? Flash::success(trans('admin.update.success')) : Flash::error(trans('admin.update.fail'));
return redirect(route('admin.user.index'));
}
示例5: update
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, City $city, User $user)
{
$this->validate($request, ['name_first' => 'required', 'name_last' => 'required', 'username' => 'required', 'bio' => 'required', 'email' => 'required|unique:users,id,' . $request->get('id')]);
$user->fill(Input::all());
$user->resluggify();
$user->save();
return Redirect::route('{city}.users.index', $city->iata)->with('message', 'User updated');
}
示例6: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('users')->delete();
//add admin
$user = new User();
$user->fill(array('name' => 'admin', 'email' => 'admin@admin.com', 'password' => bcrypt('admin'), 'role' => 'admin', 'active' => 1));
$user->save();
}
示例7: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store(Request $request)
{
$this->validate($request, ['email' => 'required|email', 'password' => 'required|confirmed']);
$user = new User();
$user->fill($request->only(['email', 'is_admin']));
$user->password = Hash::make($request->get('password'));
$user->save();
return redirect()->route('users.index')->with('flash', ['level' => 'success', 'message' => 'Added "' . $user->email . '".']);
}
示例8: 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, ['name' => 'required|unique:users|max:255', 'email' => 'required|email']);
$input = Input::all();
$user = new User();
$user->fill($input);
$user->save();
return json_encode(array('id' => $user->id, 'name' => $user->name, 'email' => $user->email));
}
示例9: store
/**
* Store a newly created resource in storage.
*
* @param CreateUserRequest $request
* @return Response
*/
public function store(CreateUserRequest $request)
{
$user = new User();
$user->fill($request->all());
$user->save();
$message = trans('messages.user_created_successfully');
Flash::success($message);
return redirect()->route('admin.users.index');
}
示例10: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$user = new User();
$user->fill($request->all());
$user->save();
$user->attachRoles(Input::get('rol'));
Flash::success('Usuario creado......');
return redirect()->route('user.create');
}
示例11: createUser
public function createUser()
{
$input = Input::all();
$input['password'] = Hash::make($input['password']);
$user = new User();
$user->fill($input);
$user->save();
return $user;
}
示例12: postSignup
public function postSignup(Request $request)
{
$this->validate($request, ['username' => 'required|unique:users', 'email' => 'required|unique:users', 'password' => 'required|min:6']);
$user = new User();
$user->fill($request->all());
$user->password = Hash::make($request->input('password'));
$user->save();
Auth::login($user);
return redirect()->to('/');
}
示例13: store
protected function store(CreateUserRequest $request)
{
$user = new User();
$user->fill($request->all());
if ($user->save()) {
return redirect('/user')->with('success', 'User created succssfully');
} else {
return redirect('/user')->with('error', trans('translate.A Problem occured, Please try again later!'));
}
}
示例14: store
/**
* Store a newly created resource in storage.
*
* @param Request $request
* @return Response
*/
public function store(MaestroRequest $request)
{
$tipo = Tipo::byName('Maestro');
$maestro = new User();
$maestro->fill($request->all());
$maestro->password = \Hash::make($request->input('password'));
$maestro->tipo_id = $tipo->id;
$maestro->estatus_id = 0;
$maestro->save();
return redirect()->route('admin.maestro.index');
}
示例15: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$params = $request->all();
$user = new User();
$params['password'] = bcrypt($params['password']);
$user->fill($params);
if ($user->save()) {
return redirect()->back()->with('success_message', 'USuario agregado con exito');
}
return redirect()->back()->with('error_message', 'Error al insertar el usuario, intente de nuevo');
}