Have you ever need to use condition while using query builder? For example: if `$request->has('published')` is `true`, you need to add a new `->where` condition to your query.. To do that with a simple way, you can use the conditional clauses, not only with query builder but also with collections, eloquent orm, etc... Let's see:```php$posts = DB::table('posts')->when($request->has('published'), function ($query) {return $query->where('is_published', true);})->orderByDesc('created_at')->limit(10)->get();``` You can also use `unless` method instead of the `when` method in order to use negative cases directly. I hope you find this useful. Happy coding!