masuresh124 / agree-terms
This package is used agree terms and condition
Requires
- php: >=7.1.0
- laravel/framework: ~5.2.0||~5.3.0||~5.4.0||~5.5.0||~5.6.0||~5.7.0||~5.8.0||^6.0||^7.0||^8.0||^9.0|^10.0
This package is not auto-updated.
Last update: 2025-04-16 17:30:38 UTC
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
Authors
Features
- Accept terms and condition
- Exclude paths
- Add custom conditions