SHARE
TWEET

Untitled

a guest Jun 27th, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <button
  2.                             onclick='viewUpdate("{{$user->id}}")'
  3.                             class="button is-primary"
  4.                             slot="trigger"
  5.                             aria-controls="contentIdForA11y1"
  6.                             >
  7.                               View!
  8.                       </button>
  9.      
  10. <script>
  11.    function viewUpdate(val)
  12.    {
  13.     //alert(val);
  14.     jQuery.ajax({
  15.     url: "{{ url('dne/viewincrement') }}",
  16.     method: 'post',
  17.     data: {
  18.       'id': val
  19.     },
  20.     success: function(result){
  21.     console.log('success');
  22.     }
  23.    });
  24.   }
  25.  </script>
  26.      
  27. Route::prefix('dne')->group(function() {
  28.      Route::post('/viewincrement', 'DNEDNEFrontController@count');
  29.     }
  30.      
  31. public function count(Request $request)
  32.    {
  33.     //dd($request);
  34.     $user = DNEUser::findOrFail($id);
  35.     if(isset($user) && !empty($user)){
  36.       $user->view_counter+=1;
  37.       $user->save();
  38.      }
  39.      //$this->addData('user', $user);
  40.     return $this->getView('dne.customer.pizza');
  41.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top