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(UserRequest $request)
    {
        $user = new User($request->all());
        if(strcasecmp($request->password, $request->retry_password) != 0){
            flash('The password must be the same')->error();
            return view('admin.users.create');
        }else{
            try {
                $user->password=bcrypt($request->password);
                $save_response = $user->save();
                flash('The user '.$user->name.' was created')->success();
                return redirect()->route('users.index');
            } catch (\Illuminate\Database\QueryException $e) {
                flash('Check if Id and Email already exists or contact with your administrator because something happens while saving the data')->error();
                return view('admin.users.create');
            }
        }
    }
public function store ( UserRequest $ request ) { $ user = new User ( $ request -> all ( ) ) ; if ( strcasecmp ( $ request -> password , $ request -> retry_password ) != 0 ) { flash ( 'The password must be the same' ) -> error ( ) ; return view ( 'admin.users.create' ) ; } else { try { $ user -> password = bcrypt ( $ request -> password ) ; $ save_response = $ user -> save ( ) ; flash ( 'The user ' . $ user -> name . ' was created' ) -> success ( ) ; return redirect ( ) -> route ( 'users.index' ) ; } catch ( \ Illuminate \ Database \ QueryException $ e ) { flash ( 'Check if Id and Email already exists or contact with your administrator because something happens while saving the data' ) -> error ( ) ; return view ( 'admin.users.create' ) ; } } }
Store a newly created resource in storage.
Store a newly created resource in storage .