Guest User

Untitled

a guest
Apr 26th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. var config = {
  2. headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')}
  3. };
  4. var app = new Vue({
  5. el: '#app',
  6. data: {
  7. isCardModalActive: false,
  8. name: null,
  9. email: null,
  10. message : 'oi',
  11. video_url: '',
  12. video_title: '',
  13. video_id: '',
  14. username: '',
  15. user_id: '1'
  16. },
  17. methods: {
  18. onSubmit(message) {
  19. axios.post('{{route("message.store")}}', {message: 'Test', round: '1', video_id: '31',username: '4' }, config)
  20. .then(function(response){
  21. console.log(response)
  22. });
  23. },
  24. saveName: function(e) {
  25. if(this.name && this.email)
  26. {
  27. var mod = document.getElementById('reg-modal');
  28. mod.className += ' animate-modal';
  29. }
  30. else
  31. {
  32. alert('Please fill up your name and Email');
  33. e.preventDefault();
  34. }
  35. }
  36. }
  37. });
  38.  
  39. $comment = new Comments;
  40. $comment->message = $request->message;
  41. $comment->round = $request->round;
  42. $comment->video_id = $request->video_id;
  43. $guest_name = $request->username;
  44. $comment->user_id = $request->username;
  45. if(!is_numeric($guest_name) && $guest_name != null){
  46. $comment->user_id = -1;
  47. $comment->guest_name = $guest_name;
  48. } else {
  49. }
  50. $comment->save();
  51. return response()->json($comment);
Add Comment
Please, Sign In to add comment