app/Http/Controllers/UsersController.php
/**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
Store a newly created resource in storage.
Store a newly created resource in storage .
public function store(Request $request)
    {
      $featured_image = "";
        if ($request->hasFile('image')) {
          $path = 'images';
          $file = $request->image;
          $extension = $file->getClientOriginalExtension();
          $fileName = rand(1111,9999).".".$extension;
          $file->move($path, $fileName);
          $image = $fileName;
        }
      $input['name'] = $request->name;
      $input['telp'] = $request->telp;
      $input['email'] = $request->telp;
      $input['image'] = $image;
      $input['password'] = Hash::make($request->password);
      $input['role'] = $request->role;
      User::create($input);
      return redirect()->route('users.index');
    }
public function store ( Request $ request ) { $ featured_image = " " ; if ( $ request -> hasFile ( 'image' ) ) { $ path = 'images' ; $ file = $ request -> image ; $ extension = $ file -> getClientOriginalExtension ( ) ; $ fileName = rand ( 1111 , 9999 ) . " . " . $ extension ; $ file -> move ( $ path , $ fileName ) ; $ image = $ fileName ; } $ input [ 'name' ] = $ request -> name ; $ input [ 'telp' ] = $ request -> telp ; $ input [ 'email' ] = $ request -> telp ; $ input [ 'image' ] = $ image ; $ input [ 'password' ] = Hash :: make ( $ request -> password ) ; $ input [ 'role' ] = $ request -> role ; User :: create ( $ input ) ; return redirect ( ) -> route ( 'users.index' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .