Exemple #1
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $usuario = new User($request->all());
     // encriptamos el password
     $usuario->password = bcrypt($request->getPassword());
     $date = Carbon::now()->minute . Carbon::now()->second;
     $file = $request->file('imagen');
     $filename = $date . $file->getClientOriginalName();
     $image = \Image::make($file);
     $ruta = public_path() . '/uploads/usuarios/';
     $image->save($ruta . $filename);
     $image->resize(40, 40);
     $image->save($ruta . 'thumb/' . 'thumb_' . $filename);
     $usuario->avatar = $filename;
     $usuario->save();
     return redirect()->route('admin.usuarios.index');
 }
Exemple #2
0
 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array  $data
  * @return User
  */
 protected function create(array $data)
 {
     return User::create(['name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password'])]);
 }