PHP code example of tingo-gmbh / eloquent-traceable
1. Go to this page and download the library: Download tingo-gmbh/eloquent-traceable 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/ */
tingo-gmbh / eloquent-traceable example snippets
namespace Tingo\Traceable\Tests\Models;
use Illuminate\Database\Eloquent\Model;
use Tingo\Traceable\Traceable;
class Entity extends Model
{
use Traceable;
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'name',
'category',
'description',
'unit',
'price',
];
...
}
namespace Tingo\Traceable\Tests\Models;
use Illuminate\Database\Eloquent\Model;
class User extends Model implements Creator
{
...
/**
* @return string
*/
public function getCreatorEmail(): string
{
return $this->email;
}
/**
* @return string
*/
public function getCreatorName(): string
{
return $this->first_name . ' ' . $this->last_name;
}
}