MOON
Server: Apache
System: Linux e2e-78-16.ssdcloudindia.net 3.10.0-1160.45.1.el7.x86_64 #1 SMP Wed Oct 13 17:20:51 UTC 2021 x86_64
User: imensosw (1005)
PHP: 7.4.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: /home/imensosw/www/mpl.imenso.co/app/Pages/GenericPage.php
<?php

namespace App\Pages;

use Illuminate\Support\Str;

abstract class GenericPage
{
    public function getSection() : string
    {
        return $this->section;
    }

    public function getSubSection() : string
    {
        return $this->subsection;
    }

    public function getName() : string
    {
        return $this->name;
    }

    public function getViewPath() : string
    {
        if (! $this->getSection()) {
            return '';
        }

        if (! $this->getSubSection()) {
            return $this->getSection().'.pages';
        }

        return $this->getSection().'.pages.'.$this->getSubSection();
    }

    public function getViewName() : string
    {
        if (! $this->getName()) {
            return 'page';
        }

        if (! view()->exists($this->getViewPath().'.'.Str::kebab($this->getName()))) {
            return 'page';
        }

        return Str::kebab($this->getName());
    }

    public function getView() : string
    {
        return $this->getViewPath().'.'.$this->getViewName();
    }

    // public static function isVisibleTo($user = false) : bool
    // {
    //     if (is_object($user) && get_class($user) == User::class) {
    //         if ($this->getSection() && $this->getName()) {
    //             return config('pages.'.$this->getSection().'.'.kebab_case($this->getName()).'.visible-to.'.strtolower($user->type->getName()));
    //         }
    //     } else {
    //         if ($this->getSection() && $this->getName()) {
    //             return config('pages.'.$this->getSection().'.'.kebab_case($this->getName()).'.visible-to.guest');
    //         }
    //     }
    //     return false;
    // }
}