PHP code example of kerattila / laravel-track-author
1. Go to this page and download the library: Download kerattila/laravel-track-author 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/ */
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
Schema::table('posts', function (Blueprint $table) {
// this will automatically add created_by, updated_by and updated_by nullable columns
$table->trackAuthor();
});
namespace App;
// use Kerattila\TrackAuthor\Traits\CreatedBy;
// use Kerattila\TrackAuthor\Traits\UpdatedBy;
// use Kerattila\TrackAuthor\Traits\DeletedBy;
use Kerattila\TrackAuthor\Traits\TrackAuthor;
use Illuminate\Database\Eloquent\Model;
class Post extends Model
{
use TrackAuthor;
// use CreatedBy, UpdatedBy, DeletedBy;
}