codewiser/inarticulate 问题修复 & 功能扩展

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

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

codewiser/inarticulate

Composer 安装命令:

composer require codewiser/inarticulate

包简介

Inarticulate is not Eloquent (Laravel Redis Model)

关键字:

README 文档

README

Inarticulate is a Eloquent extender to work with Redis storage.

Inarticulate Model is absolutely the same as Eloquent Model. It has one important difference — there are no autoincrement keys in Redis. So Inarticulate has

public $incrementing = false;

Inarticulate Builder extends Eloquent Builder, but it overrides just few methods — find, insert, update, delete and exists. So just do not call any others — that are not applicable for Redis.

As Inarticulate extends Eloquent Model your may use attributes Accessors and Mutators, castings, property guards etc.

Redis key

Redis key is build up from three properties — hashed APP_KEY, $table property and model primary key. Redis key will look like

d781b523ed68d90c599832956ff10ea9:article:243

Redis expire

Set positive protected $redisExpire value to set expiration timout for Model.

Usage

To prevent Builder from resolving undefined attributes as a relations (that is not supported, you know) just define default attribute values in $attributes array.

/**
 * @property mixed id
 * @property string title
 * @property string body
 */
class Article extneds \Codewiser\Inarticulate\Model
{
    protected $attributes = [
        'title' => null,
        'body' => null
    ];
}
$article = new Article();

$article->exists; // FALSE

$article->id = 1;
$article->title = "Title";
$article->save();

$article->exists; // TRUE
$article = Article::query()->findOrFail(1);

echo $article->title; 

Builder methods

Fearlessly use these Model and Builder methods:

  • find
  • findOrFail
  • findOrNew
  • findMany
  • exists
  • refresh

Get all records

Model::all();
// or
Model::query()->get();

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-09-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固