Laravel 7.19 Released

Laravel 7.19 Released

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

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:

   ->when(! Auth::check(), function ($stringable) {
       return $stringable
           ->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:



  • 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 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)


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

Filed in: News / Releases
Laravel News Partners

Laravel Jobs

Laravel Developer
Senior Laravel Backend Engineer
Remote, USA Only, Inc.
Senior Laravel Developer
Remote, EU timezones only
Experienced Laravel Developer
Full Time ad Remote - Experienced Laravel Developer
Europe Only


Join 31,000+ others and never miss out on new tips, tutorials, and more.