承接 slam-micro/sharedmodels 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

slam-micro/sharedmodels

Composer 安装命令:

composer require slam-micro/sharedmodels

包简介

README 文档

README

This is a simple light-weight package for to get other Eloquent models in other laravel package by simply connecting to the extended database. This package is created to retrieve data from other micro-service instance.

Get Started With slam-micro/sharedmodels

##Installation

Recommended php version 8.2.1

Git Repository slam-micro/sharedmodels

Access the package Packagist slam-micro/sharedmodels

$ composer require slam-micro/sharedmodels

##Usage

$host = 'my-custom-host';
$port = 'my-custom-port';
$database = 'my-custom-database';
$username = 'my-custom-username';
$password = 'my-custom-password';

// replace with the name of the table you want to access
$table = 'table-name'; 

// replace with the fully qualified name of your model class
$modelClass = 'App\\Models\\ModelName'; 

$databaseConnection = new DatabaseConnection($host, $port, $database, $username, $password);
$models = $databaseConnection->getModels($table, $modelClass);

return $models;

Other useful of usage

// Get all records
$models->all();

// Get by ID
$models->find(1);

//delete record by ID
$var = $models->where('id', 1)->first();
return $list->delete();

//Update record by ID
$var->update(
    [
      'name' => "John Doe"
     ]
);

Author

Email: thabo.tony@gmail.com

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-02-23