clumsy/age-check

An age checker for Laravel

v0.2.6 2016-07-14 12:05 UTC

This package is not auto-updated.

Last update: 2024-10-26 16:59:26 UTC


README

Codacy Badge SensioLabsInsight

A package to help create an age-check verification.

License

Clumsy Age-Check is open-sourced software licensed under the MIT license

Installation

To get started with Age-Check, add to your composer.json file as a dependency:

composer require clumsy/age-check:0.2.*

If you are using Laravel 4, stick to the branch 0.1:

composer require clumsy/age-check:0.1.*

Configuration

After installing the Age-Check library, register the ServiceProvider in your config/app.php configuration file:

'providers' => [
    // Other service providers...

    Clumsy\AgeCheck\AgeCheckServiceProvider::class,
],

Register the middleware in your app/Http/Kernel.php file:

protected $routeMiddleware = [
        //Other middlewares...

        'age-check' => \Clumsy\AgeCheck\Http\Middleware\ValidateAge::class,
    ];

Publish the config file:

php artisan vendor:publish --provider="Clumsy\AgeCheck\AgeCheckServiceProvider" --tag="config"

and edit it according to your project. Usually you want to edit the success-url and fail-url which are the urls where the user will get redirected in case of fail or success.

Usage

Create a route group with the age-check middleware in it:

Route::group(
    [
        'middleware' => ['age-check']
    ],
    function() {
        //Your routes goes here...
    }
);

This package gives you a basic view with a basic form without styling. You should change the config file to use one of you own and use the partials views provided to help you generate the form.

You can also publish the views and change them to suit your needs:

php artisan vendor:publish --provider="Clumsy\AgeCheck\AgeCheckServiceProvider" --tag="views"