定制 tadasei/laravel-contacts 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tadasei/laravel-contacts

最新稳定版本:v2.0.0

Composer 安装命令:

composer require tadasei/laravel-contacts

包简介

A package that provides stubs for managing contact info associations with models

README 文档

README

This package provides stubs for contacts association (with various contact methods) to Eloquent models.

Features

  • Quickly generate contacts migrations, models, factories and enums.
  • Customize and extend generated code to fit your project's needs.
  • Improve development efficiency by eliminating repetitive tasks.

Installation

You can install the package via Composer by running:

composer require tadasei/laravel-contacts --dev

Publishing contacts handling utilities

To publish contacts handling utilities, use the following command:

php artisan contacts:install

Configuring The Country Model

This package references an App\Models\Country model and requires manual supply of its implementation to add phone code support through a phone_code attribute for the following contact method types:

  • landline
  • mobile
  • fax

To use a different model, edit App\Models\ContactMethod and Database\Factories\ContactMethodFactory accordingly.

Configuring Contactable Models

To extend or define which models are considered contactable, edit:

  • App\Enums\ContactableType: Add your model class names to this enum.
  • Database\Factories\ContactFactory: Customize logic to generate contacts for your specific model types.

This allows full flexibility in defining how your application links contacts to models.

Running migrations

To create the related contacts and contact_methods tables, run the generated migrations using the following command:

php artisan migrate

Usage:

$contact = $customer->contacts()->create([
    'name' => 'John Doe',
]);

$contact->contactMethods()->create([
    'type' => 'email',
    'value' => 'john@example.com',
]);

Customization

The generated code serves as a starting point. You can customize and extend it according to your project's requirements. Modify the generated utilities as needed.

Contributing

Contributions are welcome! If you have suggestions, bug reports, or feature requests, please open an issue on the GitHub repository.

License

This package is open-source software licensed under the MIT license.

统计信息

  • 总下载量: 18
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-07-26