Polyscope - The agent-first dev environment for Laravel

Laravel 7.19 Released

Published on by

Laravel 7.19 Released image

Never Miss a Laravel Release 🚀

Sign up and get an email with each new Laravel release

The Laravel team released v7.19.0 with new scheduler frequency shortcuts, conditionally appending attributes to API resources and a new Stringable when() method:

Scheduler Frequency Shortcuts

Sjors Ottjes contributed more useful scheduler frequency shortcuts:

  • everyTwoHours()
  • everyThreeHours()
  • everyFourHours()
  • everySixHours()

They provide readable shortcuts instead of using cron:

// Using cron
$schedule->job(SyncSomething::class)->cron('0 */2 * * *');
 
// Shortcut from this release
$schedule->job(SyncSomething::class)->everyTwoHours();

Conditionally Return Appended Attributes in API Resources

Jess Archer contributed a whenAppended method for API resources to append attributes conditionally. Here are some examples taken from the contributed tests:

public function toArray($request)
{
return [
'id' => $this->id,
'first' => $this->whenAppended('is_published'),
'second' => $this->whenAppended('is_published', 'override value'),
'third' => $this->whenAppended('is_published', function () {
return 'override value';
}),
'fourth' => $this->whenAppended('is_published', $this->is_published, 'default'),
'fifth' => $this->whenAppended('is_published', $this->is_published, function () {
return 'default';
}),
];
}
 
// Controller Example
return new UserResource($user->append('is_subscribed'));

Scheduled Task Failed Event

Freek Van der Herten contributed a ScheduledTaskFailed event that fires when a scheduled task fails:

$this->dispatcher->dispatch(new ScheduledTaskFailed($event, $e));

Stringable when() Method

Manojkiran Appathurai contributed a Stringable::when() method to conditionally run some “stringable” code when true:

Str::of($blogContent)
->when(! Auth::check(), function ($stringable) {
return $stringable
->limit(20)
->append('To Continue reading ')
->append(new HtmlString(
'<a href="#">Get a Subscription</a>'
));
});

Release Notes

You can see the full list of new features and updates below and the diff between 7.18.0 and 7.19.0 on GitHub. The following release notes are directly from the changelog:

v7.19.0

Added

  • Added everyTwoHours() | everyThreeHours() | everyFourHours() | everySixHours() methods to Illuminate\Console\Scheduling\ManagesFrequencies (#33393)
  • Conditionally returning appended attributes in API resources (#33422)
  • Added ScheduledTaskFailed event (#33427)
  • Added Illuminate\Support\Stringable::when() (#33455)

Fixed

  • Fixed signed urls with custom parameters (bcb133e)
  • Determine model key name correctly in Illuminate/Validation/Concerns/ValidatesAttributes.php (a1fdd53)
  • Fixed notifications database channel for anonymous notifiables (#33409)

Changed

  • Improve SQL Server last insert id retrieval (#33430, de1d159)
  • Make Str::endsWith return false if both haystack and needle are empty strings (#33434)
Paul Redmond photo

Staff writer at Laravel News. Full stack web developer and author.

Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.

image
Acquaint Softtech

Hire Laravel developers with AI expertise at $20/hr. Get started in 48 hours.

Visit Acquaint Softtech
Tinkerwell logo

Tinkerwell

The must-have code runner for Laravel developers. Tinker with AI, autocompletion and instant feedback on local and production environments.

Tinkerwell
Get expert guidance in a few days with a Laravel code review logo

Get expert guidance in a few days with a Laravel code review

Expert code review! Get clear, practical feedback from two Laravel devs with 10+ years of experience helping teams build better apps.

Get expert guidance in a few days with a Laravel code review
PhpStorm logo

PhpStorm

The go-to PHP IDE with extensive out-of-the-box support for Laravel and its ecosystem.

PhpStorm
Laravel Cloud logo

Laravel Cloud

Easily create and manage your servers and deploy your Laravel applications in seconds.

Laravel Cloud
Acquaint Softtech logo

Acquaint Softtech

Acquaint Softtech offers AI-ready Laravel developers who onboard in 48 hours at $3000/Month with no lengthy sales process and a 100 percent money-back guarantee.

Acquaint Softtech
Kirschbaum logo

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum
Shift logo

Shift

Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Shift
Harpoon: Next generation time tracking and invoicing logo

Harpoon: Next generation time tracking and invoicing

The next generation time-tracking and billing software that helps your agency plan and forecast a profitable future.

Harpoon: Next generation time tracking and invoicing
Lucky Media logo

Lucky Media

Get Lucky Now - the ideal choice for Laravel Development, with over a decade of experience!

Lucky Media
SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a Multi-tenant Laravel SaaS Starter Kit that comes with all features required to run a modern SaaS. Payments, Beautiful Checkout, Admin Panel, User dashboard, Auth, Ready Components, Stats, Blog, Docs and more.

SaaSykit: Laravel SaaS Starter Kit
MongoDB logo

MongoDB

Enhance your PHP applications with the powerful integration of MongoDB and Laravel, empowering developers to build applications with ease and efficiency. Support transactional, search, analytics and mobile use cases while using the familiar Eloquent APIs. Discover how MongoDB's flexible, modern database can transform your Laravel applications.

MongoDB

The latest

View all →
Laravel Mobile Pass: Generate Apple Wallet and Google Wallet Passes image

Laravel Mobile Pass: Generate Apple Wallet and Google Wallet Passes

Read article
PHPverse 2026 Returns June 9th image

PHPverse 2026 Returns June 9th

Read article
LLPhant: A PHP Generative AI Framework Inspired by LangChain image

LLPhant: A PHP Generative AI Framework Inspired by LangChain

Read article
Debounceable Queued Jobs in Laravel 13.6.0 image

Debounceable Queued Jobs in Laravel 13.6.0

Read article
Build Custom Middleware for Query Performance Monitoring and Optimization in Laravel with MongoDB image

Build Custom Middleware for Query Performance Monitoring and Optimization in Laravel with MongoDB

Read article
Laravel API Starter Kits Are Coming Soon! image

Laravel API Starter Kits Are Coming Soon!

Read article