Answer the question
In order to leave comments, you need to log in
How to link two columns of the same table through one Eloquent method?
Hello!
tell me how to correctly link two columns of one table with one column of another table?
task: in the admin panel, you need to display the names of users who created the post and edited the post, how to implement this correctly? or just create two separate relationships to the users table?
set several fields as the second argument in the array in one connection does not work
public function user()
{
return $this->belongsTo('App\User', ['created_by', 'modified_by']);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question