PHP code example of sfolador / devices

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

    

sfolador / devices example snippets


return [
     'allow_device_reassign' => false,
];

use Sfolador\Devices\Models\Concerns\HasDevices;

class User extends Authenticatable
{
    use HasDevices;
}

$user = User::find(1);
$user->devices;

Route::post('/devices/attach', [DeviceController::class, 'attach']);


$rules = [
    'platform' => ['Enum(DeviceType::class)],
    'token' => '
bash
php artisan vendor:publish --tag="devices-config"
bash
php artisan vendor:publish --tag="devices-migrations"
php artisan migrate