半神 Api 助手

dev-master 2024-07-25 18:36 UTC

This package is auto-updated.

Last update: 2024-09-25 19:11:55 UTC


README

HEMIS - 管理教育流程的信息系统 本系统包含“行政管理”、“教学过程”、“科研活动”和“财务管理”模块。

通过这个库,在 Laravel 框架中可以使用半神 API 的辅助库

语言

为了使用这个库,需要在 Laravel 的语言文件 .env 中添加以下两个变量。

  HEMISAPI_KEY="Sizning api kalitingiz"
  HEMISAPI_URL="Sizning hemis api asosiy urilingiz" // https://hemis.hemis.uz

使用/示例

    use Dasturchiuz\Hemisapi\HemisBackendApi;
    use Dasturchiuz\Hemisapi\Models\DeportmentModel;
    use App\Models\Departments; //Custom model for departments
    $hemisBackend = new HemisBackendApi();
    $response = $hemisBackend->getDeportmentList();
    $pagination = null;
    if($response){
        $pagination = $response->pagination;
        for ($i=1; $i <=$pagination->pageCount; $i++){
            $responseInForeach = $hemisBackend->getDeportmentList($i);
            /* @var $item DeportmentModel */
            foreach ($responseInForeach->data as $item ){
                $deportment = new Departments();
                $deportment->id = $item->id;
                $deportment->parent_id = $item->parent;
                $deportment->title = $item->name;
                $deportment->code_hemis = $item->code;
                $deportment->structure_type_code = $item->structureType->code;
                $deportment->structure_type_name = $item->structureType->name;
                $deportment->save();
            }
        }
    }

文档

文档