最佳答案
Laravel 有个方法会把可以将名词单数转为复数形式,不是简单的加个 s 就完了。比如,在 tinker
中测试,输入 status
会返回 statuses
:
if (! function_exists('str_plural')) {
/**
* Get the plural form of an English word.
*
* @param string $value
* @param int $count
* @return string
*/
function str_plural($value, $count = 2)
{
return Str::plural($value, $count);
}
}
讨论数量:
Laravel 有个方法会把可以将名词单数转为复数形式,不是简单的加个 s 就完了。比如,在 tinker
中测试,输入 status
会返回 statuses
:
if (! function_exists('str_plural')) {
/**
* Get the plural form of an English word.
*
* @param string $value
* @param int $count
* @return string
*/
function str_plural($value, $count = 2)
{
return Str::plural($value, $count);
}
}
推荐文章: