| 1 |
<?php |
| 2 |
namespace Depicter\Database\Entity; |
| 3 |
|
| 4 |
use Averta\WordPress\Database\Entity\Model; |
| 5 |
|
| 6 |
class Lead extends Model |
| 7 |
{ |
| 8 |
|
| 9 |
protected $idColumn = 'id'; |
| 10 |
|
| 11 |
protected $idForeign = 'lead_id'; |
| 12 |
|
| 13 |
/** |
| 14 |
* Resource name. |
| 15 |
* |
| 16 |
* @var string |
| 17 |
*/ |
| 18 |
protected $resource = 'depicter_leads'; |
| 19 |
|
| 20 |
/** |
| 21 |
* Retrieved the joined table name |
| 22 |
* |
| 23 |
* @var string |
| 24 |
*/ |
| 25 |
protected string $joined = ''; |
| 26 |
|
| 27 |
/** |
| 28 |
* Determines what fields can be saved without be explicitly. |
| 29 |
* |
| 30 |
* @var array |
| 31 |
*/ |
| 32 |
protected $builtin = [ |
| 33 |
'source_id', |
| 34 |
'content_id', |
| 35 |
'content_name', |
| 36 |
'created_at' |
| 37 |
]; |
| 38 |
|
| 39 |
protected $guard = [ 'id' ]; |
| 40 |
|
| 41 |
protected $format = [ |
| 42 |
'created_at' => 'currentDateTime' |
| 43 |
]; |
| 44 |
|
| 45 |
public function currentDateTime() { |
| 46 |
return gmdate('Y-m-d H:i:s', time()); |
| 47 |
} |
| 48 |
|
| 49 |
public function fields(){ |
| 50 |
return $this->hasMany(LeadField::class, $this->idForeign, $this->idColumn ); |
| 51 |
} |
| 52 |
|
| 53 |
} |
| 54 |
|