<?php

/*
 * This file is part of the AuthStack project.
 *
 * (c) Buckhill Ltd <development@buckhill.co.uk>
 *
 * This source file is subject to the Buckhill license that is bundled
 * with this source code in the file LICENSE.
 */

namespace AuthStack\SystemUser\Model;

use Illuminate\Database\Eloquent\Model;

class SystemUser extends Model
{
    protected $table = 'system_users';
    protected $fillable = ['password', 'email', 'first_name', 'last_name', 'date_format', 'config'];
    public $timestamps = true;

    protected $casts = [
        'config' => 'array',
    ];

    public function setConfigAttribute($value)
    {
        $this->attributes['config'] = json_encode($value, JSON_UNESCAPED_SLASHES);
    }
}