基于区块链的毕业设计ethos-laravel – 拉雷维尔精神

本文提供基于区块链的毕业设计国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,基于区块链的毕业设计ethos-laravel – 拉雷维尔精神 是一篇很好的国外资料

ethos-laravel

Ellucian Ethos client library, built upon MelonSmasher/ethos-php, with enhancements for Laravel.

ethos-laravel - 拉雷维尔精神 ethos-laravel - 拉雷维尔精神 ethos-laravel - 拉雷维尔精神 ethos-laravel - 拉雷维尔精神


Installation

Pull the library into your project:

composer require melonsmasher/ethos-laravel

Publish ethos.php to the config directory:

php artisan vendor:publish --tag ethos

API Docs

Complete API docs can be found here.

Features

  • Ethos settings are read from .env.

  • Ethos sessions are cached.

  • Efficiently handles authentication.

    • New authenticated sessions are created before the previous session expires.
  • Traits for 316 Ethos data models, related by using the Ethos object ID.

  • Trait model responses can be cached for a configurable amount of time.

Config Options

# Your Ethos API key / refresh token. ETHOS_SECRET=YourEthosApiKey # The base url that should be used to connect to Ethos. If omitted https://integrate.elluciancloud.com is used. ETHOS_BASE_URL=https://integrate.elluciancloud.com # The ERP backend that is connected to Ethos. Must be either 'banner' or 'colleague'. If nothing is supplied 'colleague' is used. ETHOS_ERP_BACKEND=banner # How long trait responses should remain in the cache in seconds. Set to 0 to disable. If omitted this option is disabled. ETHOS_TRAIT_CACHE_TTL=300 

Usage/Examples

Using Helper Function

<?php  namespace AppHttpControllers;  use IlluminateHttpRequest; use MelonSmasherEthosPHPStudentCoursesClient;  class ExampleController extends Controller {     public function index()     {         $ethos = getEthosSession();         $courses = new CoursesClient($ethos);         return $courses->read()->toJson();     } }

Using Facade

<?php  namespace AppHttpControllers;  use IlluminateHttpRequest; use MelonSmasherEthosPHPLaravelFacadeEthos; use MelonSmasherEthosPHPFoundationBuildingsClient;  class ExampleController extends Controller {     public function index()     {         $ethos = Ethos::get();         $buildings = new BuildingsClient($ethos);         return $buildings->read()->data();     } }

Traits

HasEthosPersonModel

An example of how to use the HasEthosPersonModel trait on a Laravel User model.

User migration:

<?php  use IlluminateSupportFacadesSchema; use IlluminateDatabaseSchemaBlueprint; use IlluminateDatabaseMigrationsMigration;  class CreateUsersTable extends Migration {     /**      * Run the migrations.      *      * @return void      */     public function up()     {         Schema::create('users', function (Blueprint $table) {             $table->increments('id');             $table->string('ethos_person_id')->unique(); // Add this to your user's model and fill it with the related Ethos Person ID.             $table->string('username');             $table->string('name');             $table->string('password');             $table->rememberToken();             $table->timestamps();         });     }      /**      * Reverse the migrations.      *      * @return void      */     public function down()     {         Schema::dropIfExists('users');     } }

User model:

<?php  namespace App;  use IlluminateFoundationAuthUser as Authenticatable; use MelonSmasherEthosPHPLaravelTraitsFoundationHasEthosPersonModel;  class User extends Authenticatable {     use HasEthosPersonModel;      /**      * The attributes that are mass assignable.      *      * @var array      */     protected $fillable = [         'ethos_person_id', // <--- This attribute must be present on your model.         'username',         'name'     ]; }

Example usage :

<?php  namespace AppHttpControllers;  use IlluminateHttpRequest; use AppModelUser;  class MyController extends Controller {          /**      * Create a new controller instance.      *      * @return void      */     public function __construct()     {         $this->middleware('auth');     }          /**     * Shows a user's Ethos Person Model     */     public function showUserAccount($id)      {         $user = User::findOrFail($id);                  return $user->ethosPerson(); // Returns the Ethos account     } }

Dev Setup

Install PHIVE

Install build tools

phive install

Install composer requirements

./composer install

ethos laravel

Ellucian Ethos客户端库,基于MelonSmasher/Ethos php构建,具有针对Laravel的增强功能。

将库拉入项目:


安装

发布埃索斯.php到config目录:

composer require melonsmasher/ethos-laravel

完整的API文档可以在这里找到。

php artisan vendor:publish --tag ethos

API文档

从.env读取Ethos设置。

功能

  • 从.env读取Ethos设置。
  • 将缓存Ethos会话。
  • 有效地处理身份验证。在上一个会话过期之前创建新的已验证会话。
  • 通过使用Ethos对象ID关联的316个Ethos数据模型的Traits。
  • Trait model响应可以缓存一段可配置的时间。你知道吗

配置选项

# Your Ethos API key / refresh token. ETHOS_SECRET=YourEthosApiKey # The base url that should be used to connect to Ethos. If omitted https://integrate.elluciancloud.com is used. ETHOS_BASE_URL=https://integrate.elluciancloud.com # The ERP backend that is connected to Ethos. Must be either 'banner' or 'colleague'. If nothing is supplied 'colleague' is used. ETHOS_ERP_BACKEND=banner # How long trait responses should remain in the cache in seconds. Set to 0 to disable. If omitted this option is disabled. ETHOS_TRAIT_CACHE_TTL=300 

用法/示例

使用助手函数

<?php  namespace AppHttpControllers;  use IlluminateHttpRequest; use MelonSmasherEthosPHPStudentCoursesClient;  class ExampleController extends Controller {     public function index()     {         $ethos = getEthosSession();         $courses = new CoursesClient($ethos);         return $courses->read()->toJson();     } }

使用Facade

<?php  namespace AppHttpControllers;  use IlluminateHttpRequest; use MelonSmasherEthosPHPLaravelFacadeEthos; use MelonSmasherEthosPHPFoundationBuildingsClient;  class ExampleController extends Controller {     public function index()     {         $ethos = Ethos::get();         $buildings = new BuildingsClient($ethos);         return $buildings->read()->data();     } }

Traits

HasEthosPersonModel

用户迁移:

用户模型:

<?php  use IlluminateSupportFacadesSchema; use IlluminateDatabaseSchemaBlueprint; use IlluminateDatabaseMigrationsMigration;  class CreateUsersTable extends Migration {     /**      * Run the migrations.      *      * @return void      */     public function up()     {         Schema::create('users', function (Blueprint $table) {             $table->increments('id');             $table->string('ethos_person_id')->unique(); // Add this to your user's model and fill it with the related Ethos Person ID.             $table->string('username');             $table->string('name');             $table->string('password');             $table->rememberToken();             $table->timestamps();         });     }      /**      * Reverse the migrations.      *      * @return void      */     public function down()     {         Schema::dropIfExists('users');     } }

示例用法:

<?php  namespace App;  use IlluminateFoundationAuthUser as Authenticatable; use MelonSmasherEthosPHPLaravelTraitsFoundationHasEthosPersonModel;  class User extends Authenticatable {     use HasEthosPersonModel;      /**      * The attributes that are mass assignable.      *      * @var array      */     protected $fillable = [         'ethos_person_id', // <--- This attribute must be present on your model.         'username',         'name'     ]; }

安装PHIVE

<?php  namespace AppHttpControllers;  use IlluminateHttpRequest; use AppModelUser;  class MyController extends Controller {          /**      * Create a new controller instance.      *      * @return void      */     public function __construct()     {         $this->middleware('auth');     }          /**     * Shows a user's Ethos Person Model     */     public function showUserAccount($id)      {         $user = User::findOrFail($id);                  return $user->ethosPerson(); // Returns the Ethos account     } }

Dev Setup

安装生成工具

安装编写器要求

phive install

Install composer requirements

./composer install

部分转自网络,侵权联系删除区块链源码网

www.interchains.cc

https://www.interchains.cc/21612.html

区块链毕设网(www.interchains.cc)全网最靠谱的原创区块链毕设代做网站 部分资料来自网络,侵权联系删除! 最全最大的区块链源码站 ! QQ3039046426
区块链知识分享网, 以太坊dapp资源网, 区块链教程, fabric教程下载, 区块链书籍下载, 区块链资料下载, 区块链视频教程下载, 区块链基础教程, 区块链入门教程, 区块链资源 » 基于区块链的毕业设计ethos-laravel – 拉雷维尔精神

提供最优质的资源集合

立即查看 了解详情