PHP code example of nowendwell / laravel-terms

1. Go to this page and download the library: Download nowendwell/laravel-terms library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

nowendwell / laravel-terms example snippets




namespace App\Http\Middleware;

use Closure;
use Illuminate\Http\Request;

class AcceptedTerms
{
    public function handle(Request $request, Closure $next)
    {
        if (
            auth()->check() &&
            ! auth()->user()->hasAcceptedTerms() &&
            ! in_array($request->path(), config('terms.excluded_paths'))
        ) {
            session(['url.intended' => $request->url()]);
            return redirect()->route('terms.show');
        }

        return $next($request);
    }
}
bash
composer vendor:publish --provider="Nowendwell\LaravelTerms\LaravelTermsServiceProvider"
php artisan migrate
 php


use Nowendwell\LaravelTerms\Traits\AcceptsTerms;

class User
{
    use AcceptsTerms;
}