So, I have a few questions ....
1) User StudentData? 2 - 1:1?
User?
( ?)
2) , ... User, . .
, "", "" "", .
"" :
public function messageSender()
{
return $this->belongsTo("App\User", 'sender');
}
public function messageRecipient()
{
return $this->belongsTo("App\User", 'recipient');
}
? User,
public function sentMessages()
{
return $this->hasMany("App\Inbox", 'sender');
}
public function receivedMessages()
{
return $this->hasMany("App\Inbox", 'recipient');
}
(.. , ),
$user->sentMessages
. ( , ... )
public function unreadSentMessages()
{
return $this->hasMany("App\Inbox", 'sender')
->where('trashed_in_sender', 0)
->where('show_in_sender', 0)
->orderBy('created_at', 'desc');
}
$user- > sentMessages , $user- > notreadSentMessages , .