with with() is for eager loading, it means the relationship data is loaded at the time you query the parent model, where eager loading will alleviate the “N+1” query problem. Example:User -> hasMany -> Post has has() is to filter the selecting model based on a relationship. So it acts very similarly to a normalContinue reading “Laravel Eloquent: has vs with vs whereHas?”