PHP code example of jeffersonsimaogoncalves / laravel-device-tracking

1. Go to this page and download the library: Download jeffersonsimaogoncalves/laravel-device-tracking library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jeffersonsimaogoncalves / laravel-device-tracking example snippets



// add the trait to your user model
class User{
    //...
    use IvanoMatteo\LaravelDeviceTracking\Traits\UseDevices;
    //...
}

// call on login or when you want update and check the device informations
// by default this function is called when the Login event is fired 
// only with the "web" auth guard
// if you want you can disable the detect_on_login option in the config file
$device = \DeviceTracker::detectFindAndUpdate();

// flag as verified for the current user
\DeviceTracker::flagCurrentAsVerified();

// flag as verified for a specific user
\DeviceTracker::flagAsVerified($device, $user_id);

// flag as verified for a specific user by device uuid
\DeviceTracker::flagAsVerifiedByUuid($device_uuid, $user_id);
bash
php artisan migrate
bash
php artisan vendor:publish --provider "IvanoMatteo\LaravelDeviceTracking\LaravelDeviceTrackingServiceProvider" --tag config