PHP code example of delatbabel / applog

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

    

delatbabel / applog example snippets


protected function bootstrappers()
{
    $bootstrappers = parent::bootstrappers();

    // Swap out the default Laravel ConfigureLogging class with our own.
    foreach ($bootstrappers as $key => $value) {
        if ($value == 'Illuminate\Foundation\Bootstrap\ConfigureLogging') {
            $bootstrappers[$key] = 'Delatbabel\Applog\Bootstrap\ConfigureLogging';
        }
    }

    return $bootstrappers;
}

use Delatbabel\Applog\Models\Auditable;

class MyModel
{
    use Auditable;
    // ... remainder of the model code
}

Log::debug(__CLASS__.':'.__TRAIT__.':'.__FILE__.':'.__LINE__.':'.__FUNCTION__.':'.
    'POST login');

Log::debug(__CLASS__.':'.__TRAIT__.':'.__FILE__.':'.__LINE__.':'.__FUNCTION__.':'.
    'POST login', ['attributes' => $attributes ]);

use Cartalyst\Sentinel\Laravel\Facades\Sentinel;

function get_user_name()
{
    // Fetch the currently logged in user
    try {
        $user       = Sentinel::getUser();
        $username   = $user ? $user->email: '';
    } catch (\Exception $e) {
        // Ignore
    }
    return $username;
}

    php artisan vendor:publish --tag=migrations --force
    php artisan migrate