Answer the question
In order to leave comments, you need to log in
Data output left join Repository?
there is a model
User (name,email)
AND models UserAttribute (fullanme, birthday, city_id), UserService (premium,top) , City (name)
There is an interface
interface UserRepositoryContract
{
public function getAllUsersWithPaginate($perPage);
}
class UserRepository implements UserRepositoryContract
{
private $user;
public function __construct($user)
{
$this->user = $user;
}
}
public function getAllUsers($perPage)
{
}
Answer the question
In order to leave comments, you need to log in
Use connections . Add user_id to UserAttribute/UserService, hasOne relationship
public function attributes()
{
return $this->hasOne(UserAttribute::class);
}
public function city()
{
return $this->belongsTo(City::class);
}
User::with('attributes.city', 'services')
->paginate($perPage);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question