HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/anvil.komma.pro/app/KommaApp/Documents/Models/Document.php
<?php

namespace App\KommaApp\Documents\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Http\UploadedFile;

/**
 * Class Document
 *
 * Represents a document in the database
 *
 * @property-read  int id
 * @property string path
 * @property string name
 * @property integer sort_order
 * @property string documentable_id
 * @property string documentable_type
 * @property string thumb_image_url
 * @property string small_image_url
 * @property string medium_image_url
 * @property string large_image_url
 *
 * Transient properties (Not saved to the database)
 * @property UploadedFile file
 * @property string $state;
 *
 * @package App\KommaApp\Files\Model
 */
class Document extends Model
{
    const STATE_NEW = 'new';
    const STATE_PRISTINE = 'pristine';
    const STATE_MODIFIED = 'modified';
    const STATE_DELETED = 'deleted';

    protected $fillable = ['path', 'name', 'sort_order', 'documentable_id', 'documentable_type', 'thumb_image_url', 'small_image_url', 'medium_image_url', 'large_image_url'];

    /** @var UploadedFile $file associated with the document */
    public $file;

    /** @var string $state The state of the document */
    public $state = self::STATE_PRISTINE;

    public function documentable()
    {
        return $this->morphTo();
    }

    /**
     * Convert the object into something JSON serializable.
     *
     * @return array
     */
    public function toArray()
    {
        $array = parent::toArray();
        $array['state'] = $this->state;
        return $array;
    }
}