阅读(4914) (7)

Laravel 8 singular {#collection-method}

2021-07-05 09:43:53 更新

singular 方法用于将一个字符串转换为其单数形式。该函数仅支持英文:

use IlluminateSupportStr;

$singular = Str::of('cars')->singular();

// car

$singular = Str::of('children')->singular();

// child