simonbowen / laravel-isams
驱动程序,允许通过 MSSQL 或 XML 连接到 iSAMs 学校系统
v2.0.1
2020-07-07 13:56 UTC
Requires
- php: >=7.3.0
- illuminate/cache: ^7.0
- illuminate/config: ^7.0
- illuminate/database: ^7.0
- illuminate/support: ^7.0
Requires (Dev)
- fzaninotto/faker: ~1.4
- mockery/mockery: ~1.4
- phpunit/phpunit: ~8.0
This package is auto-updated.
Last update: 2024-08-29 03:41:59 UTC
README
laravel-isams
用于在 Laravel 中集成 iSAMs 数据连接的包
简介
ISAMs 是系统底层数据的官方和非官方接口。前者是一个可以通过 HTTP 请求的 XML 文件,后者是手动连接到 iSAMS MSSSQL 数据库的 SQL。
此包旨在允许您使用任一接口,同时保持相同的接口。
设置
php artisan vendor:publish
配置示例
<?php return [ 'isams' => [ 'driver' => 'xml', // Set to db to use MSSQL connection, 'xml' => [ 'url' => 'http://url/for/isams/xml', 'cache' => null, // Set cache time for XML file (defaults to 60 minutes) ], 'db' => [ 'connection' => 'sqlsrv', // Specify the database connection you wish to use from the database.php config file ] ] ];
服务提供者
将 SimonBowen\IsamsDrivers\IsamsDriversServiceProvider
添加到 config/app.php 中的服务提供者配置
用法
此包目前提供三个仓库。
- StaffRepository
- PupilRepository
- SetRepository
这些可以通过 Laravel 的 IOC 注入
use SimonBowen\IsamsDrivers\Repositories\Contracts\StaffRepository; class DemoController extends Controller { protected $repository; public function __construct(StaffRepository $repository) { $this->repository = $repository; } public function index() { $staff = $this->repository->all(); dd($staff); } }
请务必查看位于 SimonBowen\IsamsDrivers\Repositories\Contracts
的接口,以获取有关可用方法的更多信息。