PHP code example of hvlucas / laravel-logger

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

    

hvlucas / laravel-logger example snippets


class MyClass extends Model 
{
    public function getPrettyWeightAttribute()
    {
        return (int) $this->weight / 1.5;
    }
    //...
}

'loggable_models' => [
    [
        'model' => 'App\Model',
        'trackable_attributes' => [...,'pretty_weight',...]
    ],
    //...
],

'loggable_models' => 'App\MyClass'
//or
'loggable_models' => ['App\MyClass', 'App\SpecialModelNamespace\Team']

class MyClass extends Model 
{
    protected $trackable_attributes = ['name', 'title', 'role_id', 'salary', 'gender'];
    protected $sync_attributes = ['name', 'title', 'gender'];
    protected $tracks_user = false;
    protected $tracks_data = true;
    protected $is_favorite = true;
    //...
}

class MyClass extends Model 
{
    protected $hidden = ['password'];
}

Route::get('/fecthing-model/{model_id}/', 'FetchingController@fetch')->middleware('log_event');

public function __construct(...)
{
    $this->middleware('log_event')->only('fetch');
}

    $this->middleware('log_event:jumped');
console
php artisan vendor:publish
console
php artisan migrate