diff --git a/app/helpers.php b/app/helpers.php index 05e783e..e64f49e 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -3,6 +3,7 @@ use App\Models\Study; use App\Models\User; use App\Services\AuditTrail\ActivityLogger; +use Illuminate\Support\Str; use Spatie\MediaLibrary\MediaCollections\Models\Media; if (! function_exists('_h')) { @@ -128,3 +129,14 @@ function me(User|int|null $user = null): User } } } + +if (! function_exists('formatTitle')) { + function formatTitle(string $str): string + { + return Str::of($str) + ->slug() + ->replace('-', ' ') + ->title() + ->toString(); + } +}