The essential news about content management systems and mobile technology. Powered by Perfect Publisher and XT Search for Algolia.
The News Site publishes posts to the following channels: Facebook, Instagram, Twitter, Telegram, Web Push, Tumblr, and Blogger.
With the release of Laravel 11 in February 2024, Laravel will have native support for limiting the number of eagerly loaded results per parent.
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>We've integrated the code behind @staudenmeir's "eager load limit" package into Laravel 11.
— Taylor Otwell (@taylorotwell) January 16, 2024
That means in Laravel 11 this will actually work... retrieving users while eager loading only 5 posts per user... ❤️
Thanks @staudenmeir! pic.twitter.com/4IAbefwVJP
Let’s say, for example, that you want to paginate users but also eagerly load three blog posts for each user:
User::with([
'posts' => fn ($query) => $query->limit(3)
])->paginate();
The above eloquent query would look something like the following JSON representation out of the box, with optimized eager-loaded models:
Using Laravel 10 or less, it is still conveniently possible via Jonas Staudenmeir’s eager-load-limit, but will now be natively supported out of the box with Laravel 11. Here’s an example of what queries you can expect in Laravel 11 for the above code:
select count(*) as aggregate from `users`
select * from `users` limit 15 offset 0
select * from (
select *, row_number() over (partition by `posts`.`user_id`)
as `laravel_row` from `posts`
where `posts`.`user_id` in (1, 2, 3...)
)
as `laravel_table` where `laravel_row` <= 3
order by `laravel_row`
The integration for Laravel 11 was done in Pull Request #49695. A massive shout-out to Jonas for incorporating this much-used package into the core of Laravel!
The post Eager Load Limit is Coming to Laravel 11 appeared first on Laravel News.
Join the Laravel Newsletter to get all the latest Laravel articles like this directly in your inbox.
Read more https://laravel-news.com/eager-load-limit
While the Dumpable
trait is technically
new in Laravel
11, these I would say that it consolidates the idea of
dump()
and dd()
into a reusable trait so
that classes don’t have to manually implement this separately.
Application developers and package authors can also benefit from
this new illumiate/support
trait to easily add
debugging methods in chainable classes.
In Laravel 10, we already enjoy being able to chain in a
->dd()
or ->dump()
into various
framework classes, such as Carbon
,
Stringable
, the query Builder
, and
TestResponse
:
use Illuminate\Support\Carbon;
$time = Carbon::now()
->addDay()
->addMinute()
->addSecond();
// dumping before adding a minute and second
$time = Carbon::now()
->addDay()
->dump()
->addMinute()
->dump()
->addSecond();
However, in Laravel 10, the dump()
and
dd()
methods were created ad-hoc in each class
separately, whereas, in Laravel 11, all that code was consolidated
into the Dumpable trait we can use in any class. Here's an example
from the Illuminate Carbon
class in Laravel 11:
use Illuminate\Support\Traits\Dumpable;
class Carbon extends BaseCarbon
{
use Conditionable, Dumpable;
// ...
}
The implementation of dump()
looks like the
following in the Dumpable trait. The only difference with
dd()
is that the code will stop execution and
exit:
public function dump(...$args)
{
dump($this, ...$args);
return $this;
}
Shout-out to Nuno Maduro for implementing this feature in Pull Request #47122 to clean up internal usage of these methods, but also paved the way for apps and packages to utilize this trait.
The post Laravel 11 Introduces the Dumpable Trait appeared first on Laravel News.
Join the Laravel Newsletter to get all the latest Laravel articles like this directly in your inbox.
Read more https://laravel-news.com/laravel-11-dumpable-trait
The WordPress.com team is always working on new design ideas to bring your website to life. Check out the latest themes in our library, including great options for small businesses, entrepreneurs in the coaching space, and a number of other beautiful and versatile designs.
All WordPress.com ThemesYour literary haven, on the web. This partner theme was designed with book lovers of all kinds in mind. Built-in features include curated collections, newsletter integration, robust search functionality, mobile-friendly responsiveness, and more. Whether you’re operating a physical bookstore or simply sharing your literary enthusiasm with the world, Bookix is the ideal block theme.
Click here to view a demo of this theme.
Annalee is tailor-made for personal coaches. Its front page is both streamlined and informative, while providing options for videos, images, courses, and more. Its design—characterized by pronounced contrasts in color and typography—exudes an approachable and welcoming ambiance. For any kind of coach looking to bolster their brand and professionalize their online presence, Annalee is the ticket.
Click here to view a demo of this theme.
Kaze is a simple, three-column theme in which the left-hand column is a “sticky” menu while the right two columns scroll. The ample white space (or, in this case, black space) combined with a small font type makes for an elegant and modern vibe. Though this theme was created with architecture firms in mind, it’s suitable for any small business where design and professionalism are paramount.
Click here to view a demo of this theme.
Utilizing the familiar messaging interface that we all know and love, Messagerie brings a decidedly casual and playful style to your blog. Featuring stripped down text bubbles on a spare background, you don’t to have to worry about complicated extras or high-impact visuals—let the words speak for themselves.
Click here to view a demo of this theme.
Built from the bones of one of our classic blogging themes (Resonar), Tronar provides a sleek design for bloggers that combines a little bit of old-school internet nostalgia with modern simplicity. With a large, immersive featured image/post at the top and a feed of posts below, your content is front and center with this theme.
Click here to view a demo of this theme.
To install any of the above themes, click the name of the theme you like, which brings you right to the installation page. Then click the “Activate this design” button. You can also click “Open live demo,” which brings up a clickable, scrollable version of the theme for you to preview.
Premium themes are available to use at no extra charge for customers on the Explorer plan or above. Partner themes are third-party products that can be purchased for $79/year each.
You can explore all of our themes by navigating to the “Themes” page, which is found under “Appearance” in the left-side menu of your WordPress.com dashboard. Or you can click below:
All WordPress.com ThemesRead more https://wordpress.com/blog/2024/01/24/new-wordpress-com-themes-jan-24/
The digital landscape is evolving, and with it, the way we create and consume content is undergoing a remarkable transformation. As we stand at the cusp of a new era, the integration of Artificial Intelligence (AI) in content creation is not just a trend but a revolutionary step forward.
Today, we’re excited to announce our latest resources that open the doors to this new world.
This all-new course is an in-depth introduction to AI-assisted content creation, focused on functionality, practical application, and ethical implications of tools like ChatGPT. As with all of our courses, “Unlocking the Power of AI” is 100% free.
Course features:
In an age where content is king, staying ahead of the curve is crucial. AI-assisted content creation isn’t just about keeping up with the latest trends; it’s about setting the pace. Whether you’re a blogger, a digital marketer, or an entrepreneur, understanding how to leverage AI effectively can transform your content strategy. This course is designed to guide you through the nuances of AI tools, helping you to create content that resonates, engages, and inspires.
This course isn’t just about learning the ropes of AI. We’ll also explore the ethical implications of AI-generated content, understand the importance of authenticity, and learn to balance AI’s capabilities with your unique voice. We dig into hands-on practical strategies for using AI with various content types, from blogs to FAQs and beyond. The goal is to empower you with skills that go beyond the basics, giving you a competitive edge no matter your endeavor.
This engaging session complements our Unlocking the Power of AI course, showcasing the practical application of ChatGPT and the dynamic capabilities of the Jetpack AI Assistant that comes built-in to your WordPress.com site. Join us for a one-hour journey through the world of AI, where you’ll learn to craft compelling content with ease and precision.
What to expect in the webinar:
Perfect for beginners and intermediate learners, this webinar is a valuable addition to your learning journey. Elevate your content strategy and stay ahead in the digital landscape. We’re offering two sessions in January and three in February. Click below to learn more and register.
Attend this webinarWhether you’re looking to streamline your content creation process, enhance your creative output, or be in the know in an ever-evolving digital world, the combination of our AI-focused course and webinar is your key. The future is AI-assisted, and it’s brighter than ever.
Join us in embracing the future of content creation, where AI and human creativity merge to create something truly extraordinary.
Learn more Start course now Attend the webinarRead more https://wordpress.com/blog/2024/01/22/wordpress-jetpack-ai-assistant/
Read more https://build.prestashop-project.org/news/2024/live-update-january-2024/