Laravel Livewire real time chat application part 2
App/Http/Livewire
messages.php
namespace App\Http\Livewire;
use Livewire\Component;
class Messages extends Component
{
public function render()
{
return view('livewire.messages');
}
}
Resource views
users/messages.blade.php
@extends('layouts.app')
@section('content')
<div>
@livewire('messages')
</div>
@endsection
livewire/messages.blade.php
<div>
<div class="row justify-content-center">
<div class="col-md-4">
<div class="card">
<div class="card-header">
Users
</div>
<div class="card-body chatbox p-0">
<ul>
<a href=""><li class="list-item">Shahin</li></a> <a href=""><li class="list-item">Shahin</li></a>
</ul>
</div>
</div>
</div><!--end col-md-4-->
<div class="col-md-8">
<div class="card">
<div class="card-header">Shahin</div>
<div class="card-body">
messages
</div>
<div class="card-footer">
<form>
<div class="row">
<div class="col-md-8"><input type="text" wire:model="message" class="form-control"></div>
<div class="col-md-4"> <button class="btn btn-info" type="submit"><i class="far fa-paper-plane "></i> Send</button> </div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
Route
Route::view('chat','users.messages');
No comments