sellinnate / laravel-contacts-manager
一个简单的 Laravel 联系人列表处理工具包
1.0.0
2023-04-10 13:38 UTC
Requires
- php: ^8.1
- illuminate/contracts: ^10.0
- spatie/laravel-package-tools: ^1.14.0
Requires (Dev)
- laravel/pint: ^1.0
- nunomaduro/collision: ^7.9
- nunomaduro/larastan: ^2.0.1
- orchestra/testbench: ^8.0
- pestphp/pest: ^2.0
- pestphp/pest-plugin-arch: ^2.0
- pestphp/pest-plugin-laravel: ^2.0
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- spatie/laravel-ray: ^1.26
This package is auto-updated.
Last update: 2024-09-09 13:32:42 UTC
README
一个简单的 Laravel 联系人列表处理工具包
安装
您可以通过 composer 安装此包
composer require sellinnate/laravel-contacts-manager
您可以使用以下命令发布和运行迁移
php artisan vendor:publish --tag="laravel-contacts-manager-migrations"
php artisan migrate
用法
//Create a contact Contact::create([ 'first_name' => '...', 'last_name' => '...', 'business_name' => '...', 'address' => '...', 'zip_code' => '...', 'country_code' => '...', 'email' => '...', 'mobile' => '...', 'phone' => '...', 'vat_number' => '...', 'notes' => '...', 'type' => '...' // MANDATORY: 'private' or 'business', ]); //Create a contact list ContactList::create([ 'user_id' => '1' //desired user id 'name' => 'this is the list name' ]); //attach a contact to a list and viceversa $contact->lists()->attach($listId); $list->contacts()->attach($contactId); //fetch contacts from a list $list->contacts; //fetch all lists connected to a contact $contact->lists; //Contact and ContactList are taggable. Feel free to use tags as you desire in your flow //Tags are meant to be a flexible way to categorize your model. $tag = Tag::create(['name' => 'Test tag', 'user_id' => $user->id]); $contact->tags()->attach($tag->id); $contactList->tags()->attach($tag->id); //Retrive taggable elements from a tag $tag->contacts; //returns a collection of Contacts $tag->contactLists; //returns a collection of ContactList
测试
composer test
变更日志
有关最近更改的更多信息,请参阅 变更日志
贡献
有关详细信息,请参阅 贡献指南
安全漏洞
请查看我们的安全策略,了解如何报告安全漏洞 安全策略
鸣谢
许可协议
MIT 许可协议 (MIT)。有关更多信息,请参阅 许可文件