PHP code example of ivanomatteo / laravel-device-tracking

1. Go to this page and download the library: Download ivanomatteo/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/ */

    

ivanomatteo / laravel-device-tracking example snippets



use IvanoMatteo\LaravelDeviceTracking\Facades\DeviceTracker;
use IvanoMatteo\LaravelDeviceTracking\Traits\UseDevices;

// add the trait to your user model
class User {
    use 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 vendor:publish --provider "IvanoMatteo\LaravelDeviceTracking\LaravelDeviceTrackingServiceProvider" --tag migrations
bash
php artisan migrate
bash
php artisan vendor:publish --provider "IvanoMatteo\LaravelDeviceTracking\LaravelDeviceTrackingServiceProvider" --tag config