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/SBogers85/equichecker.com/app/KommaApp/Pages/Models/Page.php
<?php
/**
 *
 *
 * @author      Komma <info@komma.pro>
 * @copyright   (c) 2012-2016, Komma Mediadesign
 */

namespace KommaApp\Pages\Models;

use KommaApp\Kms\Core\NestedSets\Nodes\EloquentNode as NestedSetNode;

class Page extends NestedSetNode
{
    protected $table = 'pages';

    /*
    * Transient properties on Eloquent models
    * These are not saved to database.
    */
    public $thumbnail = false;
    public $images = false;
    public $parent_id = false;
    public $title = false;


    protected $fillable = ['active', 'controller', 'searchable', 'site_id', 'lft', 'rgt', 'tree', 'code_name', 'call_to_action'];

    public function site()
    {
        return $this->belongsTo(\KommaApp\Sites\Models\Site::class);
    }

    public function translations()
    {
        return $this->hasMany(\KommaApp\Pages\Models\PageTranslation::class);
    }

    public function languages()
    {
        return $this->belongsToMany(\KommaApp\Languages\Models\Language::class, 'page_translations')
            ->withPivot('slug', 'name', 'description')
            ->withTimestamps();
    }

    public function getParentId()
    {
        if ($this->getDepth() == 0) {
            // Node is root node
            return 0;
        }
        return $this->getParent()->id;
    }

}