定制 aurorawebsoftware/flymodel 二次开发

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

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

aurorawebsoftware/flymodel

最新稳定版本:12.0.0

Composer 安装命令:

composer require aurorawebsoftware/flymodel

包简介

Laravel Models on the FLY !

README 文档

README

FlyModel is a Laravel package that empowers you to create and manage models dynamically, on the fly !.

It allows to define flexible and customizable models and model fields without needing to change the database schema.

This package streamlines your workflow by eliminating the need to define models explicitly in your codebase. Instead, you can generate and interact with models as needed, based on a unique "deck" identifier.

The package uses FlexyField Package as Dynamic Field Engine.

For More Info Visit: https://github.com/AuroraWebSoftware/FlexyField

🚀 Features

  • Dynamic Model Creation: Instantiate models with a specified "deck" identifier without pre-defining them.
  • Dynamic Fields : Define flexible and customizable fields on models without needing to change the database schema.
  • Automatic Scoping: Models are automatically scoped according to the deck, ensuring data isolation.
  • Seamless Integration: Works effortlessly with Laravel’s Eloquent ORM.

📦 Installation

To get started with FlyModel, follow these steps:

Install the Package

Add FlyModel to your project using Composer:

composer require aurorawebsoftware/flymodel

Run the Migration

Create the necessary database table for storing fly models:

php artisan migrate

📘 Usage

Creating and Using Fly Models

With FlyModel, you can dynamically create models and perform various operations. Here’s how:

Instantiate a Model with a Deck

$building = FlyModel::of('building');

Save the Model if not saved or created before

$building->save();

Perform Field Operations

$building->flexy->name = 'Headquarter Building'
$building->flexy->address = 'Ali Pasha Ave. number 10';
$building->flexy->city = 'İstanbul';
$building->flexy->floor = 7;
$building->flexy->area = 313;
$building->flexy->active = true;

$building->save();

Perform Eloquent Operations

$buildings = FlyModel::of('building')->all();

$istanbulBuildings = FlyModel::of('building')
                        ->where('flexy_city', 'İstanbul')
                        ->get();

$largeBuildings = FlyModel::of('building')
                    ->where('flexy_area', '>' 500)
                    ->orderBy('flexy_area')
                    ->get();
                    
$highBuildingsInIstanbul = FlyModel::of('building')
                            ->where('flexy_floor', '>' 10)
                            ->where('flexy_city', 'İstanbul')
                            ->get();

🧪 Testing

FlyModel integrates with Laravel’s testing environment. Here’s an example of how to write tests for it:

💬 Contributing

We welcome contributions to improve FlyModel!

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-10-09