mustafaabdujalil
2 months ago
123
2
Laravel

Database quries

Posted 2 months ago by mustafaabdujalil

Which better fetch data with relations or by do many queries ?? Example

$data = Data::with('relationOne','relationTwo','relationThree','relationFour')->where(..,...)->.........->get();

OR

$dataIds = Model::pluck('id');
$data = Data::whereIn('id',$dataIds)->get();

Please sign in or create an account to participate in this conversation.