siriondev/consellrep 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

siriondev/consellrep

Composer 安装命令:

composer require siriondev/consellrep

包简介

Composer package per a la integració amb el procés de validació de la Identitat Digital Republicana del Consell per la República Catalana

README 文档

README

Installation

This package can be used with Laravel 8.0 or higher.

Install the package via composer:

composer require siriondev/consellrep

The service provider will automatically get registered. You may manually add the service provider in your config/app.php file:

'providers' => [
    // ...
    Siriondev\ConsellRepublica\Providers\ConsellRepublicaProvider::class,
];

Config and Translations

You should publish the translations and the config/cxr.php config file with:

php artisan vendor:publish --tag="consellrep-config"
php artisan vendor:publish --tag="consellrep-translations"

Migrations

You may also want to publish the migration to add the idrepublicana field into your users table:

php artisan vendor:publish --tag="consellrep-migrations"

Clear your config cache

php artisan optimize

Usage

Validator

You can use the idrepublicana rule to check whether the user input is valid or not.

public function rules()
{
    return [
        'id' => 'required|idrepublicana'
    ];
}

You can also set parameters to check whether the IDR is valid, active, underaged, or just check the format.

public function rules()
{
    return [
        'id' => 'required|idrepublicana:active,valid,underaged,format'
    ];
}

Facade

You can also use the IdentitatDigitalRepublicana Facade. The validate method returns an object that can be used to check different attributes from the IDR.

use Siriondev\ConsellRepublica\Facades\IdentitatDigitalRepublicana;

class Controller extends BaseController
{
    public function register(Request $request)
    {
        $idr = IdentitatDigitalRepublicana::validate($request->id);

        if ($idr->getStatus()) {    // Request OK

            $idr->isValid();        // IDR is valid

            $idr->isActive();       // IDR is active

            $idr->isUnderaged();    // IDR is underaged

            $idr->isFormat();       // IDR format correct (C-999-99999)

        } else {

            $idr->getMessage();     // Get the error message
        }
    }
}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-3.0
  • 更新时间: 2021-04-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固