Flipjms / age-check by flipjms

An age checker for Laravel
164
2
2
Package Data
Maintainer Username: flipjms
Maintainer Contact: flipjms@gmail.com (Filipe Santos)
Package Create Date: 2015-04-01
Package Last Update: 2016-07-14
Home Page:
Language: PHP
License: MIT
Last Refreshed: 2024-11-22 03:16:36
Package Statistics
Total Downloads: 164
Monthly Downloads: 2
Daily Downloads: 1
Total Stars: 2
Total Watchers: 2
Total Forks: 0
Total Open Issues: 0

Age-Check

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"