app/Http/Controllers/UserCaptchaController.php
/**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
Update the specified resource in storage.
Update the specified resource in storage .
public function update(Request $request)
    {
        $this->validate($request, [
            'challenge' => 'required',
            'solving' => 'required'
        ]);
        $solve = $request->input('challenge');
        $answer = $request->input('solving');
        $user =  DB::table('user_captchas')->where('user_id', auth()->user()->id);
        $accept =  DB::table('user_captchas')->where('user_id', auth()->user()->id)->first();
            if($answer == $solve) {
                $user->increment('Solved',1);
                $user->increment('Earnings',0.020);
                $user->decrement('captcha_count',1);
                return response()->json($accept);
            }
        return redirect()->back()->with('error', 'WRONG!');
         $this->validate($request, [
             'captcha' => 'required|captcha'
         ]);
         return redirect('dashboard/incode')->with('success', 'Correct!');
    }
public function update ( Request $ request ) { $ this -> validate ( $ request , [ 'challenge' => 'required' , 'solving' => 'required' ] ) ; $ solve = $ request -> input ( 'challenge' ) ; $ answer = $ request -> input ( 'solving' ) ; $ user = DB :: table ( 'user_captchas' ) -> where ( 'user_id' , auth ( ) -> user ( ) -> id ) ; $ accept = DB :: table ( 'user_captchas' ) -> where ( 'user_id' , auth ( ) -> user ( ) -> id ) -> first ( ) ; if ( $ answer == $ solve ) { $ user -> increment ( 'Solved' , 1 ) ; $ user -> increment ( 'Earnings' , 0.020 ) ; $ user -> decrement ( 'captcha_count' , 1 ) ; return response ( ) -> json ( $ accept ) ; } return redirect ( ) -> back ( ) -> with ( 'error' , 'WRONG!' ) ; }
Update the specified resource in storage.
Update the specified resource in storage .
// $UserCaptcha = UserCaptcha::find($id); // $UserCaptcha->increment('Solved',1); // $UserCaptcha->increment('Earnings',0.10); // $UserCaptcha->decrement('captcha_count',1); // $UserCaptcha->save(); // return redirect()->back()->with('success', 'Correct!'); // return redirect('/dashboard/')->with('success', 'Post Created'); // return redirect()->back()->with('success', 'Your captcha is correct.'); // // $this->validate($request, [ //     'captcha' => 'required|captcha' // ]); // return redirect('dashboard/incode')->with('success', 'Correct!');