35 lines
675 B
PHP
35 lines
675 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Models;
|
||
|
|
|
||
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||
|
|
use Illuminate\Database\Eloquent\Model;
|
||
|
|
use Illuminate\Support\Str;
|
||
|
|
|
||
|
|
class EmployeeMailToken extends Model
|
||
|
|
{
|
||
|
|
use HasFactory;
|
||
|
|
|
||
|
|
protected $fillable = [
|
||
|
|
'email',
|
||
|
|
'hashcode',
|
||
|
|
'employee_id'
|
||
|
|
];
|
||
|
|
|
||
|
|
protected static function booted()
|
||
|
|
{
|
||
|
|
static::creating(function ($employee) {
|
||
|
|
$employee->hashcode = Str::uuid();
|
||
|
|
});
|
||
|
|
}
|
||
|
|
/**
|
||
|
|
* Has one Employee
|
||
|
|
*
|
||
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||
|
|
*/
|
||
|
|
public function employee()
|
||
|
|
{
|
||
|
|
return $this->belongsTo(Employee::class);
|
||
|
|
}
|
||
|
|
}
|