$str = preg_replace('#<img[^>]+src="[^"]*?([^/"]+)\.gif"[^>]*>#i', ':$1', $str);
$items = User::when($request->get('login'), function($query, $login){ $query->where('login', $login) })
->when($request->get('date_start'), function($query, $date_start){ $query->where('date_start', '>=', $date_start) })
->when($request->get('date_end'), function($query, $date_end){ $query->where('date_end', '<=', $date_end) })
->get();