Advertisement

#69 Dating|Social Networking in Laravel 5.8 | Integrate Live Chat Box (IV)

#69 Dating|Social Networking in Laravel 5.8 | Integrate Live Chat Box (IV) In Part-69 of dating series, we will continue working on integrating chat box for users with Laravel, Ajax and jQuery. In this video, we will continue working on the functionality of the chat box.

1) Update chat.js file :-
We will update chat.js file with isTyping and notTyping functions. isTyping function we will call when user is typing something and notTyping function we will call when user is not typing anything.

And we will call notTyping function in sendMessage function after user sends the message.

2) Create Routes for isTyping and notTyping in web.php file with username parameter like below :-

Route::post('/chat/isTyping', 'ChatController@isTyping');
Route::post('/chat/notTyping', 'ChatController@notTyping');

3) Create isTyping and notTyping functions in ChatController :-
We will create isTyping and notTyping functions in ChatController. As stated earlier, isTyping function we will call when user is typing and notTyping function we will call when user is ideal.

In isTyping function, we will compare username who is typing and updates users table with 1 value for column 'user is typing'.

In notTyping function, we will compare username who is typing and updates users table with 0 value for column 'user is typing'.

4) Update Header Statement :-
Add below statement at the top of ChatController to include User model :-

use App\User;

To be continued in next video...

dating social networking website in laravel 5.8,chat laravel 5.8,dating chat laravel 5.8,chatting laravel script,chat ajax jquery laravel,ajax chat,ajax chat laravel 5.8,user chat laravel,chat laravel 5.8 functionality,integrate chat in laravel website,how to add chat in laravel,add chat in laravel website,

Post a Comment

0 Comments