app/Http/Controllers/Main_Controller/UserController.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)
    {
        $validatedData = $request->validate([
            'email' => 'required|unique:users',
        ]);
        $data = new User();
        $data['name']=$request->username;
        $data['mobile']=$request->mobile;
        $data['email']=$request->email;
        $data['password']=Hash::make($request->password);
        $profileimage=$request->proficeimage;
        if($request->hasFile('proficeimage')){
            $x = 'abcdefghijklmnopqrstuvwxyz0123456789';
            $x = str_shuffle($x);
            $x = substr($x, 0, 6) . '.PI_S.';
            $profileImageFilename = time() . $x . $profileimage->getClientOriginalExtension();
            Image::make($profileimage->getRealPath())->resize(250, 200)->save(public_path('/Media/user_profile/' . $profileImageFilename));
            $data['image']=$profileImageFilename;
        }
        $data->save();
        $notification=array(
            'messege'=>'Successfully Profile Updated!',
            'alert-type'=>'success'
        );
        return Redirect()->back()->with($notification);
    }
public function store ( Request $ request ) { $ validatedData = $ request -> validate ( [ 'email' => 'required|unique:users' , ] ) ; $ data = new User ( ) ; $ data [ 'name' ] = $ request -> username ; $ data [ 'mobile' ] = $ request -> mobile ; $ data [ 'email' ] = $ request -> email ; $ data [ 'password' ] = Hash :: make ( $ request -> password ) ; $ profileimage = $ request -> proficeimage ; if ( $ request -> hasFile ( 'proficeimage' ) ) { $ x = 'abcdefghijklmnopqrstuvwxyz0123456789' ; $ x = str_shuffle ( $ x ) ; $ x = substr ( $ x , 0 , 6 ) . '.PI_S.' ; $ profileImageFilename = time ( ) . $ x . $ profileimage -> getClientOriginalExtension ( ) ; Image :: make ( $ profileimage -> getRealPath ( ) ) -> resize ( 250 , 200 ) -> save ( public_path ( '/Media/user_profile/' . $ profileImageFilename ) ) ; $ data [ 'image' ] = $ profileImageFilename ; } $ data -> save ( ) ; $ notification = array ( 'messege' => 'Successfully Profile Updated!' , 'alert-type' => 'success' ) ; return Redirect ( ) -> back ( ) -> with ( $ notification ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .