Skip to main content

Black Friday 2025! Only until December 1st: coupon FRIDAY25 for 40% off Yearly/Lifetime membership!

Read more here

familytree365/backend

90 stars
1 code files
View familytree365/backend on GitHub

app/Models/Chat.php

Open in GitHub
use Illuminate\Database\Eloquent\Model;
 
class Chat extends Model
{
//
public function getChatsByUser($userId){
$chats = $this->whereHas('users', function ($query) use($userId){
$query->where('user_id', $userId);
})->get();
//return $chats[0]->users;
foreach($chats as $chat){
$chat = $this->format($chat, $userId);
}
return $chats;
}
//
}

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.