human018/smart-name
Composer 安装命令:
composer create-project human018/smart-name
包简介
A Model Trait that quickly & intuitively change names from a full name into separate first, last and other name parts.
README 文档
README
A Model Trait that quickly & intuitively change names from a full name into separate first, last and other name parts.
Prerequisites
This Trait uses the Laravel framework and requires Laravel 5 and above.
It also requires that your model table has columns named 'first_name', 'last_name' and 'title' in order to process the name.
Installing
Add the package to your composer file.
composer require Human018/laravel-smart-name
Add the trait to any Model you wish to apply it to.
use Human018\SmartName\Traits\SmartNameTrait; class User { use SmartNameTrait; }
This introduces a new attribute method to your model called name.
$user->name = "Mr John Doe"; // Will perform the following: $user->title = "Mr"; $user->first_name = "John"; $user->last_name = "Doe"; $user->name; // returns "Mr John Doe";
This trait also processes email addresses if it detects the value to be an email address.
$user->name = "john@mail.com" // Will perform the following: $user->first_name = "john";
Authors
- Simon Woodard - Initial work - Website
License
This project is licensed under the GNU License - see the LICENSE.md file for details
统计信息
- 总下载量: 16
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2021-01-18