public function messages_from()
{
return $this->hasMany('Message','from_id');
}
public function messages_to()
{
return $this->hasMany('Message','to_id');
and
public function from()
{
return $this->belongsTo('User','from_id');
}
public function to()
{
return $this->belongsTo('User','to_id');
}
I think these should be fine.
and also use only id for users table, not user_id
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community