masuresh124/agree-terms 问题修复 & 功能扩展

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

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

masuresh124/agree-terms

最新稳定版本:1.07

Composer 安装命令:

composer require masuresh124/agree-terms

包简介

This package is used agree terms and condition

README 文档

README

This plugin offer an intuitive, user-friendly interface where users can easily add agree terms and conditions component.

Installation

Install agree terms component with the composer

 composer require masuresh124/agree-terms

Add the following code in config\app.php

  /**
  * Package Service Providers...
  */
  Masuresh124\AgreeTerms\Providers\AgreeTermsProvider::class,

Run the following command to publish the service provider

  php artisan vendor:publish --provider="Masuresh124\AgreeTerms\Providers\AgreeTermsProvider"

Run the following command to run the migration

  php artisan migrate

In Model\User.php add the trait

 <?php
namespace App\Models;

use Illuminate\Foundation\Auth\User as Authenticatable;
use Masuresh124\AgreeTerms\Traits\AgreeTermsTrait;

class User extends Authenticatable
{
    use AgreeTermsTrait;
   .
   .
   .

}

In app\Http\Kernel.php add the following middleware

     protected $routeMiddleware = [
        .
        .
        'agree-terms'      => \Masuresh124\AgreeTerms\Http\Middleware\AgreeTermsMiddleware::class,
    ];

In routes/web.php add the following middleware for routes

  Auth::routes();

  Route::middleware(['auth', 'agree-terms'])->group(function () {
    Route::get('/dashboard', [App\Http\Controllers\HomeController::class, 'index'])->name('dashboard');
});

Go To resources/views/agree-terms/form.blade.php

  • Add layout to this page as per the application design
@include('agree-terms.terms')
<form action="{{ route(config('agree-terms.store_route')) }}" method="post">
    @csrf
    <div class="form-check">
        <input name="is_agreed" type="checkbox" class="form-check-input" id="is_agreed">
        <label class="form-check-label" for="is_agreed">Terms and Conditions</label>
        @error('is_agreed')
            <div class="invalid-feedback" role="alert">{{ $message }}</div>
        @enderror
    </div>

    <div class="form-group">
        <input type="submit" class="btn btn-primary" value="Submit">
    </div>
</form>

Go To resources/views/agree-terms/terms.blade.php

  • Add application terms and conditions content
<h2>Please agree to our updated Terms of Service.</h2>
<div id="terms">
    This place we can add terms and conditions
.
.
.
.
</div>

Updating

If the package is already installed and you are trying to update it to the latest version, please follow the instructions below:

  • Take a backup of the existing config file located at app/config/agree-terms.php.
  • Run the following commands:

Note: The commands below will replace the existing config file with the new one. After that, compare the new config file with your backup and add any missing values as needed.

  composer require masuresh124/agree-terms
  php artisan vendor:publish --provider="Masuresh124\AgreeTerms\Providers\AgreeTermsProvider"  --tag="config-agree-terms" --force

Badges

MIT License

Authors

Features

  • Accept terms and condition
  • Exclude paths
  • Add custom conditions

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-04-09