belongsTo(User::class, 'user_id'); } public function sender() { return $this->belongsTo(Gateway::class, 'sender_id'); } protected static function booted() { static::creating(function ($emailLog) { $emailLog->uid = str_unique(); }); } }