Update (view): redesign
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
@@ -19,6 +20,11 @@ public function register(): void
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
//
|
||||
Str::macro('readDuration', function (...$text) {
|
||||
$totalWords = str_word_count(implode(' ', $text));
|
||||
$minutesToRead = round($totalWords / 200);
|
||||
|
||||
return (int) max(1, $minutesToRead).' min read';
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user