DEV Community

Morcos Gad
Morcos Gad

Posted on • Edited on

Features (without timestamps - Str wrap static method and ... ) Laravel 9.31

In the new version 9.31 we have Some of the new features.

withoutTimestamps() method where updated_at will not change

$user = User::first();

// `updated_at` is not changed...
User::withoutTimestamps(
    fn () => $user->update(['reserved_at' => now()])
);
Enter fullscreen mode Exit fullscreen mode
  • Model getAppends() method

added an accessor method to Model to get the accessors that are being appended to model arrays. This could be useful for custom model mappings

$model->getAppends();
Enter fullscreen mode Exit fullscreen mode

missing static Str::wrap() method, which was only available via Stringable

Str::wrap('-bar-', 'foo', 'baz'); // 'foo-bar-baz'
str('-bar-')->wrap('foo', 'baz'); // 'foo-bar-baz'
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-9-31-0
Source :- https://www.youtube.com/watch?v=-g7BRU7L78c

Top comments (0)