<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class CtznMaster extends Model
{
    use SoftDeletes;

    protected $table = 'ctzn_master';
    protected $primaryKey = 'CTM_Id';

    protected $fillable = [
        'Name',
        'Mobile',
        'Email',
        'Documents',
        'Address',
        'Area_id'
    ];

protected $casts = [
    'Documents' => 'array'
];

public function getDocumentsAttribute($value)
{
    if (!$value) return [];

    $files = is_array($value) ? $value : json_decode($value, true);

    return $files; // ✅ direct return
}
}
