承接 kakhura/laravel-check-requests 相关项目开发

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

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

kakhura/laravel-check-requests

Composer 安装命令:

composer require kakhura/laravel-check-requests

包简介

This package checks requests

README 文档

README

Docs

Installation

Add the package in your composer.json by executing the command.

composer require kakhura/laravel-check-requests

For Laravel versions before 5.5 or if not using auto-discovery, register the service provider in config/app.php

'providers' => [
    /*
     * Package Service Providers...
     */
    \Kakhura\CheckRequest\CheckRequestServiceProvider::class,
],

Configuration

If you want to change default configuration, you must publish default configuration file to your project by running this command in console:

php artisan vendor:publish --tag=kakhura-check-requests-config

This command will copy file [/vendor/kakhura/laravel-check-requests/config/kakhura.check-requests.php] to [/config/kakhura.check-requests.php]

Default kakhura.check-requests.php looks like:

return [
    /**
     * Which methods supports this package.
     */
    'request_methods' => [
        'post',
        'put',
    ],

    /**
     * Package use or not auth user check.
     */
    'use_auth_user_check' => false,
];

Views

After publish Configuration, you must publish views, by running this command in console:

php artisan vendor:publish --tag=kakhura-check-requests-views

This command will copy file [/vendor/kakhura/laravel-check-requests/resources/views] to [/resources/views/vendor/admin/check-requests]

Migrations

After publish Views, you must publish migrations, by running this command in console:

php artisan vendor:publish --tag=kakhura-check-requests-migrations

This command will copy file [/vendor/kakhura/laravel-check-requests/database/migrations] to [/database/migrations]

After publish Migrations, you must add HasRelatedRequest trait in your model in which you want check if request already had sent:

use Kakhura\CheckRequest\Traits\Models\HasRelatedRequest;

class Application extends Model
{
    use HasRelatedRequest;
}

You must create RequestIdentifier instance in all your model create functionality like this:

use Models\Application;

class ApplicationService extends Service
{
    public fucntion create(array $data) 
    {
        ...
        $application = Application::create($data);
        $application->createRequestIdentifier(strval($requestId));
        ...
    }
}

After this, all of your route on which you want to check request existence, you must use middleware alias with_request_identifier.

Also, you can check if request already sent and receive model on which request had sent. Endpoint is http://domain.com/requests/check/{requestId}. This endpoint return 404 not found if request not found. If request found, you will receive response like this:

return [
   'id' => 'model_uuid' ?: 'model_id',
   'model' => 'application',
];

Enjoy.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-10-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固