Laravel Code Review - How to create a LOCAL QUERY SCOPE in your model

preview_player
Показать описание
In this Laravel Code Review, I will show you how to refactor your code and create a LOCAL QUERY SCOPE in your Laravel model. This will reduce code duplication and help take your coding to the next level.

Click here to subscribe

Reddit

Medium

Facebook

Twitter

LinkedIn

Github

#laravel #laraveltutorial #webdevelopment #laraveltips
Рекомендации по теме
Комментарии
Автор

Hi!
What do You think about this syntax in the scope?
$query->when($search, function ($query) use ($search) {
$query->where('name', $search);
}) {

GergelyCsermely