iwedmak / url-auth
Auth urls in laravel 5 by token with lifetime
v0.0.1
2018-06-21 14:22 UTC
Requires
- php: >=5.5.0
- illuminate/database: 5.*
- laravel/framework: 5.*
- nesbot/carbon: 1.*
This package is auto-updated.
Last update: 2024-11-08 19:11:08 UTC
README
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', ], ];