Flipjms / age-check by flipjms

An age checker for Laravel
162
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-04-25 15:14:38
Package Statistics
Total Downloads: 162
Monthly Downloads: 0
Daily Downloads: 0
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"