What is new in Laravel 5.8.4

What is new in Laravel 5.8.4

Mar 16, 2019 / Ramesh Mhetre

The Laravel team released v5.8.4 couple of days back with an HTTP Kernel middleware getter & a new collection join method.

How to use getRouteMiddleware

The HTTP Kernel class has a new getRouteMiddleware() method which could come in handy to ensure that a middleware has been registered:

/** @test */
public function it_registers_a_custom_route_middleware()
{
    $middlewares = resolve(\App\Http\Kernel::class)->getRouteMiddleware();

    $this->assertArrayHasKey('custom', $middlewares);
    $this->assertEquals(\App\Http\Middleware\Custom::class, $middlewares['custom']);
}

How to use Collect::join()

Then new Collect::join() method to join all items from the collection using a string. The final item can use a separate “glue” string as well:

collect(['a', 'b', 'c']))->join(', ')); // returns 'a, b, c' 
collect(['a', 'b', 'c']))->join(', ', ' and ')); // returns 'a, b and c' 
collect(['a', 'b']))->join(', ', ' and ')); // returns 'a and b' 
collect(['a']))->join(', ', ' and ')); // returns 'a' 
collect([]))->join(', ', ' and ')); // returns ''

The last new addition is adding Danish-specific characters to the Str class for proper support when the language is da.

v5.8.4 (2019-03-12)

Added

  • Added Illuminate\Support\Collection::join() method (#27723)
  • Added Illuminate\Foundation\Http\Kernel::getRouteMiddleware() method (#27852)
  • Added danish specific transliteration to Str class (#27857)

Fixed

  • Fixed JSON boolean queries (#27847)

Complete change log is here.


Laravel Laravel News

Similar Articles

PHP develop your own package with local composer environment

PHP develop your own package with local composer environment

Developing your own PHP composer package locally & integrating local file symlink within your application can speeds up development immensely.
Read more...
Laravel Zero: A Micro-framework for console applications

Laravel Zero: A Micro-framework for console applications

Get leverage of laravel magic to create console applications within a micro framework.
Read more...
Convert webpage to PDF or image in laravel

Convert webpage to PDF or image in laravel

Browsershot is package to convert webpage to image or PDF in laravel.
Read more...