app/Http/Controllers/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)
    {
        $user = new User();
        if ($request['password'] == $request['newPassword'])
            $request['password'] = bcrypt($request['password']);
        else
            return redirect('user/create')->with('status', trans('user.error_create_user'));
        if ($request['date_of_birth'] != null)
            $request['date_of_birth'] = Carbon::parse($request['date_of_birth'])->format('Y-d-m');
        try {
            $user::create($request->all());
            return redirect('user/create')
                ->with('status', trans('user.create_user'))
                ->with('status_box', 'success');
        } catch (\Exception $e) {
            return redirect('user/create')
                ->with('status', trans('user.error_create_user'))
                ->with('status_box', 'danger');
        }
    }
public function store ( Request $ request ) { $ user = new User ( ) ; if ( $ request [ 'password' ] == $ request [ 'newPassword' ] ) $ request [ 'password' ] = bcrypt ( $ request [ 'password' ] ) ; else return redirect ( 'user/create' ) -> with ( 'status' , trans ( 'user.error_create_user' ) ) ; if ( $ request [ 'date_of_birth' ] != null ) $ request [ 'date_of_birth' ] = Carbon :: parse ( $ request [ 'date_of_birth' ] ) -> format ( 'Y-d-m' ) ; try { $ user :: create ( $ request -> all ( ) ) ; return redirect ( 'user/create' ) -> with ( 'status' , trans ( 'user.create_user' ) ) -> with ( 'status_box' , 'success' ) ; } catch ( \ Exception $ e ) { return redirect ( 'user/create' ) -> with ( 'status' , trans ( 'user.error_create_user' ) ) -> with ( 'status_box' , 'danger' ) ; } }
Store a newly created resource in storage.
Store a newly created resource in storage .