PHP Classes
elePHPant
Icontem

File: src/routes.php

Recommend this page to a friend!
  Classes of Wedmak  >  PHP Artisan Auth Laravel 5  >  src/routes.php  >  Download  
File: src/routes.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Artisan Auth Laravel 5
Laravel service provider to track visitors
Author: By
Last change:
Date: 8 months ago
Size: 643 bytes
 

Contents

Class file image Download
<?php

\Route::get('/urlauth/{urlauthtoken}',
    function (
$urlauthtoken)
    {
       
$record=\iWedmak\UrlAuth\UrlAuth::where('token', $urlauthtoken)
        ->
where('lifetime', '>', \Carbon\Carbon::now())
        ->
first();
        if(
$record)
        {
           
$record->increment('visits');
            \
Auth::loginUsingId($record['user_id'], true);
            \
Event::fire(new \iWedmak\UrlAuth\Events\UrlVisit($record));
            return
redirect($record['url']);
        }
       
$throw=\Config::get('urlauth.exception');
       
pre($throw);
        throw new
$throw('no token');
    }
)->
name('urlAuth')->middleware('web');