DEV Community

Morcos Gad
Morcos Gad

Posted on

New Things Added - Laravel 8.78 Released

Let's get started quickly I found new things in Laravel 8.78 Released I wanted to share with you.

  • For example, if you uncheck a form checkbox input it is not sent to the server. You might have to write something like the following
if ($request->missing('boolean_setting')) {
    $request->merge(['boolean_setting' => 0]);
}
Enter fullscreen mode Exit fullscreen mode

Now you can define values that are merged with the request if missing

$request->mergeIfMissing(['boolean_setting' => 0]);
$request->boolean_setting;
Enter fullscreen mode Exit fullscreen mode
  • the ability to define custom validation rules that will run as part of default password rules using the rules() method The rules() method accepts a single rule, an array of rules, or a closure for a closure validation rule
Password::defaults(function () {
    return Password::min(8)
        ->symbols()
        ->mixedCase()
        ->uncompromised()
        ->rules(new ZxcvbnRule());
});
Enter fullscreen mode Exit fullscreen mode
php artisan schedule:clear-cache
Enter fullscreen mode Exit fullscreen mode
$collection = collect([
    ['name' => 'Taylor Otwell', 'sort' => 34],
    ['name' => 'Abigail Otwell', 'sort' => 30],
    ['name' => 'Taylor Otwell', 'sort' => 36],
    ['name' => 'Abigail Otwell', 'sort' => 32],
]);

$sorted = $collection->sortBy([
    ['name', 'asc'],
    ['sort', 'desc'],
]);
Enter fullscreen mode Exit fullscreen mode
  • Assert Batch Count assertBatchCount() method to the Bus facade, which asserts how many batches have been dispatched
Bus::assertBatchCount(3);
Enter fullscreen mode Exit fullscreen mode
  • HTML String Method toHtmlString() method to Str and Stringable
// Before
new HtmlString(Str::of($content)->markdown());

// After
Str::of($content)
    ->markdown()
    ->html();
Enter fullscreen mode Exit fullscreen mode
  • Lazy Loading Eloquent Results
$flights = Flight::where('de', true)->lazy(100);
$flights->each->archive();
$flights = Flight::where('de', true)->lazyByIdDesc(100);
Enter fullscreen mode Exit fullscreen mode
  • Adding Full-text Indexes
$table->string('name')->fulltext();
Enter fullscreen mode Exit fullscreen mode
  • Hiding Columns in "select *" Statements
$table->string('password')->invisible();
Enter fullscreen mode Exit fullscreen mode
  • New allowIf() & denyIf() Gate Methods
  • Retrieve Request Input as Carbon Instances
$request->date('when', 'Y-m-d', 'Africa/Cairo');
Enter fullscreen mode Exit fullscreen mode

Sources :- https://www.youtube.com/watch?v=OdxVhb_kfvE
Sources :- https://laravel-news.com/laravel-8-78-0
Sources :- https://www.youtube.com/watch?v=0tDGI2IPv5Q
I hope you have fun.

Top comments (0)