LaravelPackages.net
Acme Inc.
Toggle sidebar
iwedmak/url-auth

Auth urls in laravel 5 by token with lifetime

9
0
v0.0.1
About iwedmak/url-auth

iwedmak/url-auth is a Laravel package for auth urls in laravel 5 by token with lifetime. It currently has 0 GitHub stars and 9 downloads on Packagist (latest version v0.0.1). Install it with composer require iwedmak/url-auth. Discover more Laravel packages by iwedmak or browse all Laravel packages to compare alternatives.

Last updated

laravel-5-url-auth

Mostly for use in emails, so user can click url and get redirected with authentication. Url in email have lifetime, in hours. Monitors url visits reads, have event UrlVisit.

  • install
composer require iwedmak/url-auth
  • Or
php composer.phar require iwedmak/url-auth
  • Or add to composer.json
"iwedmak/url-auth": "*"

Register provider, add this to config/app.php in providers array:

iWedmak\UrlAuth\UrlAuthServiceProvider::class,

After that u will need to publish config

php artisan vendor:publish

and publish migrations and migrate

php artisan urlauth:migration
php artisan migrate

Now you can user urlauth($user_id, $url) function in your blade template(or anywhere), like this:

{{urlauth($user['id'], route('some.route'))}}

You can listen for \iWedmak\UrlAuth\Events\UrlVisit event. in EventServiceProvider.php

protected $listen = [
    '\iWedmak\UrlAuth\Events\UrlVisit' => [
        'App\Listeners\SomeListener',
    ],
];
Comments