Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hy can you please help me.. #2

Open
afaqahmad1234 opened this issue Mar 11, 2023 · 4 comments
Open

Hy can you please help me.. #2

afaqahmad1234 opened this issue Mar 11, 2023 · 4 comments

Comments

@afaqahmad1234
Copy link

can you please help me. how can i start conversation with any user from blade file

@extends('layouts.app')

@section('content')
    <tbody >
        @foreach ($contacts as $contact)
            <tr>
                <td>
                    <h4>{{ $contact->name }}</h4>
                </td>
                <td>
                    <button>Chat</button>
                </td>
                
            </tr>
        @endforeach
    </tbody>
@endsection

@afaqahmad1234 afaqahmad1234 changed the title Hy you please help me.. Hy can you please help me.. Mar 11, 2023
@ERaufi
Copy link

ERaufi commented Mar 11, 2023

base on the video you added in facebook send you can achieve that by sending the contact id with the URL parameter

@extends('layouts.app')

@section('content')
    <tbody >
        @foreach ($contacts as $contact)
            <tr>
                <td>
                    <h4>{{ $contact->name }}</h4>
                </td>
                <td>
        <a href="your_chat_page_link/{{$contact->id}}">
         <button>Chat</button>
         </a>
                </td>
                
            </tr>
        @endforeach
    </tbody>
@endsection

and in your route
Route::get('your_chat_page_link/{id}',[YOUR_CONTROLLER::class,'YOUR_METHOD_NAME'])

then in your YOUR_CONTROLLER where you redirect to your blade file just send the id or name with the help you compact

@afaqahmad1234
Copy link
Author

base on the video you added in facebook send you can achieve that by sending the contact id with the URL parameter

@extends('layouts.app')

@section('content')
    <tbody >
        @foreach ($contacts as $contact)
            <tr>
                <td>
                    <h4>{{ $contact->name }}</h4>
                </td>
                <td>
        <a href="your_chat_page_link/{{$contact->id}}">
         <button>Chat</button>
         </a>
                </td>
                
            </tr>
        @endforeach
    </tbody>
@endsection

and in your route Route::get('your_chat_page_link/{id}',[YOUR_CONTROLLER::class,'YOUR_METHOD_NAME'])

then in your YOUR_CONTROLLER where you redirect to your blade file just send the id or name with the help you compact

Thank you for your effort, but it did not work its created in vue.js can you please check it https://github.com/abdellatif-laghjaj/laravel-chat-app/tree/main/resources/js/components

@abdellatif-laghjaj
Copy link
Owner

Hello, I used Vue js to pass data through components, but in case you want to use blade instead of it, you can do a specific route (just like our friend told you to do), by getting the contact details via contact id, and when you click on it you show all the messages between you and that contact!

@afaqahmad1234
Copy link
Author

Hello, I used Vue js to pass data through components, but in case you want to use blade instead of it, you can do a specific route (just like our friend told you to do), by getting the contact details via contact id, and when you click on it you show all the messages between you and that contact!

yes i did this but did not work this. because in vue we have used @selected="startConvo", when open that chat page it should be selected already. but i don't know how to do this. I'm workin in vue.js for first time

<ContactList :contacts="contacts" :messages="messages" @selected="startConvo"/> <Conversation :contact="selectedContact" :messages="messages" @new="saveNewMessage" />

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants