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.
The Laravel team released v10.47 this week, which added the
whereAll
and whereAny
methods to the
query builder, the ability to use sorting flags with the Collection
sortByMany
method, and more.
This week will likely be the last release to the 10.x branch before Laravel 11’s release on Tuesday, March 12th, 2024. Laravel 10 will continue to receive bug fixes until August 6th, 2024, and security fixes until February 4th, 2025.
whereAll
and whereAny
query
builder methods@musiermoore contributed a new whereAll
and whereAny
methods to the query builder, along with
orWhereAll
and orWhereAny
methods. These
new methods can search against multiple columns using
or
or and
logic
// Before using `orWhere`
User::query()
->where(function ($query) use ($search) {
$query
->where('first_name', 'LIKE', $search)
->orWhere('last_name', 'LIKE', $search)
->orWhere('email', 'LIKE', $search)
->orWhere('phone', 'LIKE', $search);
});
// Using `whereAny`
User::whereAny(
[
'first_name',
'last_name',
'email',
'phone'
],
'LIKE',
"%$search%"
);
Here’s an example of using whereAll
, in which all
columns would need to match using AND
:
$search = 'test';
User::whereAll([
'first_name',
'last_name',
'email',
], 'LIKE', "%$search%");
/*
SELECT * FROM "users" WHERE (
"first_name" LIKE "%test%"
AND "last_name" LIKE "%test%"
AND "email" LIKE "%test%"
)
*/
You can combine multiple like this using orWhereAll
and orWhereAny
methods.
sortByMany
CollectionsTim Withers contributed the ability to pass multiple
sorting options to the Collection sortBy
method.
Before this update, you could accomplish this using multiple
callables, but using PHP’s sorting flags:
// Pull Request before example
$this->campaigns = $campaigns
->with('folder', 'campaignCategory')
->get()
->sortBy([
fn ($a, $b) => str($a->folder?->name)->lower() <=> str($b->folder?->name)->lower(),
fn ($a, $b) => str($a->campaignCategory->name)->lower() <=> str($b->campaignCategory->name)->lower(),
fn ($a, $b) => str($a->name)->lower() <=> str($b->name)->lower(),
])
// Using sorting flags
$this->campaigns = $campaigns
->with('folder', 'campaignCategory')
->get()
->sortBy(['folder.name', 'campaignCategory.name', 'name'], SORT_NATURAL | SORT_FLAG_CASE)
You can learn more about sorting flags from the sort function in the PHP manual.
$failOnTimeout
on Queue ListenersSaeed Hosseini contributed the ability to set
the $failOnTimeout
property on the queue job that
indicates if the job should fail if the timeout is exceeded:
class UpdateSearchIndex implements ShouldQueue
{
public $failOnTimeout = false;
}
You can see the complete list of new features and updates below and the diff between 10.46.0 and 10.47.0 on GitHub. The following release notes are directly from the changelog:
Str::apa()
" fix by @osbre in https://github.com/laravel/framework/pull/503400
TTL by @kayw-geek in https://github.com/laravel/framework/pull/50359whereAll
and whereAny
methods to the query builder by @musiermoore
in https://github.com/laravel/framework/pull/50344The post Query Builder whereAll() and whereAny() Methods Added to Laravel 10.47 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-10-47-0
The release of Laravel
11 and Laravel
Reverb will happen on Tuesday, March 12, 2024. Along with major
updates to Laravel, we'll get a new welcome page when creating a
new Laravel application with laravel new
or
composer.
I thought it would be fun to see how the welcome page has evolved over previous versions of Laravel. Whether you are new to the framework or have been around a while, there's something special about creating a new Laravel project and seeing that welcome screen!
Laravel 11 will feature a light and dark theme, which looks gorgeous and inviting. It has a vibrant background, clean icons, and a welcoming feel that inspires creativity:
It's hard to believe that Laravel 10 was released a year ago on February 14, 2023. Over the last year, we've received countless amazing new features and quality-of-life updates. Here's what the welcome page looks like with a fresh Laravel 10 installation:
Notably, the Laravel logo is centered and is only the logo mark. Laravel 9 and 8 had a left-aligned logo + Laravel text mark:
The welcome page featured in Laravel 8 was the first time we saw a significant change since Laravel 5.x. Laravel 8 was released on September 8, 2020, during the period of time Laravel released a major version every six months:
Laravel's branding was technically updated around the Laravel 6 release. However, Laravel 8 was the first time the new logo was introduced on the welcome page. It featured four main areas/links: documentation, Laravel News, Laracasts, and prominent ecosystem links.
Between Laravel 6 and 7, we didn't see any significant changes
to the welcome page, but at some point in the 5.x
releases, the welcome page included links to documentation,
Laracasts, Laravel News, Forge, and GitHub:
Laravel 5.0's landing page had the words "Laravel 5" and
rendered a random inspiring quote using the Inspiring
facade:
<div class="content">
<div class="title">Laravel 5</div>
<div class="quote">{{ Inspiring::quote() }}</div>
</div>
Laravel 4.2 had a minimal welcome page featuring a nostalgic
logo (base64 image) and folder structure, which included this
hello.php
file, with the text, "You have arrived."
The post The Evolution of the Laravel Welcome Page 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-welcome-page
Read more https://build.prestashop-project.org/news/2024/core-monthly-2024-02-01-2024-02-29/
As Automattic CEO Matt Mullenweg teased in a January blog post, our team at WordPress.com is working hard to enhance our developer experience. Improving what you see in your dashboard when you log into WordPress.com is one of our biggest goals.
Today, we’re excited to unveil a more powerful wp-admin experience (if you know, you know), which will soon be available to all sites on Creator and Entrepreneur plans. Read on to find out how to get early access.
For many years, the default view for WordPress.com users has been a modernized, more friendly version of the classic WordPress experience. Around the office, we call this interface “Calypso.” It offers sleek post/page management, easy profile edits, built-in tips and resources for starting or growing your site, and more.
While the Calypso interface is ideal for some folks, we’ve heard from a lot of developers that you’d prefer easy access to the classic WordPress dashboard experience. So, we’re doing just that by making it possible for wp-admin to be the default view when you log in.
Our mission here is to empower our power users—those on Creator and Entrepreneur plans—to leverage WordPress to its fullest. This update promises:
While this initial launch is for Creator and Entrepreneur subscribers, our commitment extends to all WordPress.com users. We’re excited about the possibility of expanding these features to everyone in the future.
To access the wp-admin interface you know and love, please join our email list below to be considered for early access.
And stay tuned for even more updates coming your way, including a few menu and navigation changes that you won’t want to miss.
Read more https://wordpress.com/blog/2024/03/04/wp-admin/
Recently, at Treblle, we released a Visual Studio Code extension to work with our free developer tool, API Insights. After releasing this new tool, we wanted to look for ways developers building OpenAPI Specifications could benefit without stopping what they were doing.
So, for those who need to be made aware, API Insights is a free developer tool we created at Treblle that lets you get insights into your API design. It will score your OpenAPI Specification against:
The way this works is that we analyze your specification to understand what this API does. We then compare your API to a set of industry standards for APIs and see how close you are to having an "industry standard API".
However, we go a step further than just analyzing your specification; we send a request to the first endpoint that could be successful and measure load time and response size. We can analyze something similar to understand your API better.
The VS Code extension will allow you to analyze your specifications without leaving your editor. Even better, though, is that it will then watch this file for changes and prompt you to re-run the analysis if a change is detected.
We wrote about this new free tool in a little more detail on our blog and would love to hear your thoughts about the extension - also, what developer tool you would find helpful! You never know; we may build it.
The post VS Code Extension for API Insights 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/vs-code-extension-for-api-insights