PHP code example of robtrehy / laravel-user-preferences

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

    

robtrehy / laravel-user-preferences example snippets


    'database' => [
        'table' => 'users',
        'column' => 'preferences',
        'primary_key' => 'id'
    ],
    'cache' => [
        'prefix' => 'user-',
        'suffix' => '-preferences',
    ],
    'defaults' => [
        'theme' => 'blue',
        'show_welcome' => true
    ]

UserPreferences::set(string [setting], [value]);

UserPreferences::setDefaultPreferences();

UserPreferences::reset(string [setting]);

UserPreferences::get(string [setting]);

UserPreferences::all()

UserPreferences::has(string [setting]);

    php artisan vendor:publish --provider="RobTrehy\LaravelUserPreferences\UserPreferencesServiceProvider" --tag="config"
    

    php artisan vendor:publish --provider="RobTrehy\LaravelUserPreferences\UserPreferencesServiceProvider" --tag="migrations" && php artisan migrate