Skip to content

Commit

Permalink
add Str::humanize() macro
Browse files Browse the repository at this point in the history
  • Loading branch information
uyab committed Jan 15, 2020
1 parent c60ab81 commit 2794e93
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Mixin/StrMixin.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,17 @@

namespace Laravolt\Support\Mixin;

use Illuminate\Support\Str;

class StrMixin
{
public function humanize()
{
return function ($string) {
return trim(preg_replace('/\s+/', ' ', Str::title(str_replace('_', ' ', $string))));
};
}

public function mask()
{
return function ($str, $first, $last, $mask = '*') {
Expand Down

0 comments on commit 2794e93

Please sign in to comment.