PHP code example of labrodev / laravel-trackable

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

    

labrodev / laravel-trackable example snippets

 



namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Labrodev\Trackable\ModelHasActorTracker;

class ExampleModel extends Model
{
    use ModelHasActorTracker;
}

$table->string('created_by');
$table->string('updated_by')
 
 /**
 * Column to track the actor for creation.
 *
 * @return string
 */
protected function modelHasActorTrackerCreatedByColumn(): string
{
   return 'created_by'; // put your column name instead
}
 
 /**
 * Column to track the actor for updates
 *
 * @return string
 */
protected function modelHasActorTrackerUpdatedByColumn(): string
{
   return 'updated_by'; // put your column name instead
}
 
/**
* @return mixed
*/
protected function modelHasActorTrackerIdentifier(): mixed
{
    // Put your own logic
}
bash
composer analyse