soysaltan/appender 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

soysaltan/appender

Composer 安装命令:

composer require soysaltan/appender

包简介

Take your appends control in Laravel 5.6+

README 文档

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

While working with Laravel, sometimes you have to return fields that are not in your db table (https://laravel.com/docs/8.x/eloquent-serialization#appending-values-to-json). However, you may want to hide these fields that you add in some cases. In this case, you need to dominate the eloquent model.Now, you can do it easily with this package.

This package includes a Appends trait. You can use the Appends trait in any model you want. For example, if you want to add to the User model:

class User extends Model
{
    use HasFactory, Appends; // <--add this; 
    ...

Installation

You can install the package via composer for Laravel 5.6+:

composer require soysaltan/appender

Usage

class User extends Model
{
    use HasFactory, Appends; // <--add this; 
    
    protected $appends = ['created_at_by_human', 'created_at_formatted'];

If you want to get your model without appends, just drop this line

User::$withoutAppends=true; // User -> your user mmodel

Note: If your model extends a custom class, you need to ensure that your extended class has Concerns\HasAttributes trait.Otherwise this package doesn't work since it uses Concerns\HasAttributes::getArrayableAppends method

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-05-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固