Laravel 8 singular {#collection-method}
singular
方法用于将一个字符串转换为其单数形式。该函数仅支持英文:
use Illuminate\Support\Str;
$singular = Str::of('cars')->singular();
// car
$singular = Str::of('children')->singular();
// child
singular
方法用于将一个字符串转换为其单数形式。该函数仅支持英文:
use Illuminate\Support\Str;
$singular = Str::of('cars')->singular();
// car
$singular = Str::of('children')->singular();
// child