DEV Community

Morcos Gad
Morcos Gad

Posted on

New Things Added - Laravel 8.79 Released

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

  • Paginator onLastPage() Method
@if ($paginator->onFirstPage())
    {{-- ... --}}
@endif

{{-- Before --}}
@if (!$paginator->hasMorePages())
    {{-- ... --}}
@endif

{{-- After --}}
@if ($paginator->onLastPage())
    {{-- ... --}}
@endif
Enter fullscreen mode Exit fullscreen mode
  • Implement Full-Text Search for MySQL and PostgreSQL
Schema::create('articles', function (Blueprint $table) {
    $table->id('id');
    $table->string('title', 200);
    $table->text('body');
    $table->fulltext(['title', 'body']);
});

// Search for "databases" in the title and body fulltext index...
$articles = DB::table('articles')
    ->whereFulltext(['title', 'body'], 'database')
    ->get();

// Search for "databases" in the title and body fulltext index with boolean mode...
$articles = DB::table('articles')
    ->whereFulltext(['title', 'body'], 'database', ['mode' => 'boolean'])->get();

// Search for "databases" in the title and body fulltext index with an expanded query...
$articles = DB::table('articles')
    ->whereFulltext(['title', 'body'], 'database', ['expanded' => true])->get();

Enter fullscreen mode Exit fullscreen mode
  • New Stringable Methods whenContains() and whenContainsAll()
// Before
$stringable = Str::of('some important announcement');

if ($stringable->contains(['important', 'emergency'])) {
    $stringable->upper();
}

return (string) $stringable;

// After
return (string) Str::of('some important announcement')
    ->whenContains(
        ['important', 'emergency'],
        fn (Stringable $stringable) => $stringable->upper(),
    );
Enter fullscreen mode Exit fullscreen mode

I hope you enjoyed with me and to learn more about this release visit the sources and search more. I adore you who search for everything new.
Source :- https://laravel-news.com/laravel-8-79-0

Discussion (1)

Collapse
mikecarolan profile image
Mike-Carolan

Very nice brother!!! Thank you!