<?php #CodeGenerator V3 Δ 1ccd8db572cc1f033a6313121a77103c Δ DYNAMICALLY GENERATED FILE - Do not modify this line! Remove it completely to protect the file from changes.
/**
 * Model Class
 *
 * @version     3.0.$Revision:$
 * @version     SVN: $Id:$
 * @version     STUB: 1.6.0
 * @generated   2026-04-14 17:09:35
 * @package     bplan-base/globals
 * @subpackage  Models
 * @author      Emilio Cannarozzo <emilio.cannarozzo@bplan-solutions.de>
 * @author      Wassilios Meletiadis <wassilios.meletiadis@bplan-solutions.de>
 * @copyright   Copyright (C) 2025, 2026 bplan-solutions GmbH & Co. KG <https://www.bplan-solutions.de/>
 * /Δ\
 */

namespace BplanBase\Globals\Models;


use BplanBase\Globals\Models\User;
use BplanBase\Globals\Observers\UserRecordObserver;
use BplanBase\Globals\Scopes\TenantScope;
use Illuminate\Database\Eloquent\Attributes\ObservedBy;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;


/**
 * Model Class
 *
 * @version     1.0.0 / 2026-04-14
 * @author      Emilio Cannarozzo <emilio.cannarozzo@bplan-solutions.de>
 * @author      Wassilios Meletiadis <wassilios.meletiadis@bplan-solutions.de>
 */
#[ObservedBy([UserRecordObserver::class])]
class UserRecord extends Model
{


/* +++ TRAITS +++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */


    use SoftDeletes;


/* +++ CLASS CONSTANTS +++ ++++++++++++++++++++++++++++++++++++++++++++++++++ */


/* +++ OBJECT MEMBERS +++ +++++++++++++++++++++++++++++++++++++++++++++++++++ */


    /**
     * The accessors to append to the model's array form.
     *
     * @var         array<int, string>
     *
     * @version     1.0.0 / 2026-04-14
     */
    protected $appends = [
        'full_name',
        'full_name_reverted',
    ];


    /**
     * @var         array<string, string>
     *
     * @version     1.0.0 / 2026-04-14
     */
    protected $casts = [
        'created_at' => 'datetime',
        'deleted_at' => 'datetime',
        'updated_at' => 'datetime',
    ];


    /**
     * The attributes that are mass assignable.
     *
     * @var         array<int, string>
     *
     * @version     1.0.0 / 2026-04-14
     */
    protected $fillable = [
        'email',
        'first_name',
        'id',
        'last_name',
    ];


    /**
     * The attributes that aren't mass assignable.
     *
     * @var         array<int, string>
     *
     * @version     1.0.0 / 2026-04-14
     */
    protected $guarded = [
        'created_at',
        'deleted_at',
        'updated_at',
        'uuid',
    ];


    /**
     * The attributes that should be hidden for serialization.
     *
     * @var         array<int, string>
     *
     * @version     1.0.0 / 2026-04-14
     */
    protected $hidden = [];


    /**
     * The table associated with the model.
     *
     * @var         string
     */
    protected $table = 'user_records';


    /**
     * Indicates if the model should be timestamped.
     *
     * @var         bool
     */
    public $timestamps = true;


/* +++ CLASS MEMBERS +++ ++++++++++++++++++++++++++++++++++++++++++++++++++++ */


/* +++ OBJECT METHODS +++ +++++++++++++++++++++++++++++++++++++++++++++++++++ */


    /**
     *
     * @return      string
     *
     * @version     1.0.0 / 2026-04-14
     * @author      Emilio Cannarozzo <emilio.cannarozzo@bplan-solutions.de>
     * @author      Wassilios Meletiadis <wassilios.meletiadis@bplan-solutions.de>
     */
    public function getFullNameAttribute(): string
    {
        return trim($this->first_name.' '.$this->last_name);

    } // getFullNameAttribute()


    /**
     *
     * @return      string
     *
     * @version     1.0.0 / 2026-04-14
     * @author      Emilio Cannarozzo <emilio.cannarozzo@bplan-solutions.de>
     * @author      Wassilios Meletiadis <wassilios.meletiadis@bplan-solutions.de>
     */
    public function getFullNameRevertedAttribute(): string
    {
        return trim($this->last_name.', '.$this->first_name, ',');

    } // getFullNameRevertedAttribute()


    /**
     *
     * @return      BelongsTo
     *
     * @version     1.0.0 / 2026-04-14
     * @author      Emilio Cannarozzo <emilio.cannarozzo@bplan-solutions.de>
     * @author      Wassilios Meletiadis <wassilios.meletiadis@bplan-solutions.de>
     */
    public function user(): BelongsTo
    {
        return $this->belongsTo(User::class, 'id')
            ->withoutGlobalScope(TenantScope::class);

    } // user()


/* +++ CLASS METHODS +++ ++++++++++++++++++++++++++++++++++++++++++++++++++++ */


} // class UserRecord extends Model {}
