PHP code example of coreproc / nova-auditing-user-fields

1. Go to this page and download the library: Download coreproc/nova-auditing-user-fields 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/ */

    

coreproc / nova-auditing-user-fields example snippets




namespace App;

use Illuminate\Database\Eloquent\Model;
use OwenIt\Auditing\Contracts\Auditable;

class User extends Model implements Auditable
{
    use \OwenIt\Auditing\Auditable;

    // ...
}



use Coreproc\NovaAuditingUserFields\CreatedBy;
use Coreproc\NovaAuditingUserFields\UpdatedBy;
use Illuminate\Http\Request;

class User extends Resource
{
    // ...
    
    public function fields(Request $request)
    {
        return [
            // ...
            
            CreatedBy::make('Created By'),
            
            UpdatedBy::make('Updated By')->onlyOnDetail(),
            
            // ...
        ];
    }
}