Spamworldpro Mini Shell
Spamworldpro


Server : Apache/2.4.62 (Unix) OpenSSL/1.0.2k-fips
System : Linux server1.richineiserver.com 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User : fdshops ( 1003)
PHP Version : 8.2.21
Disable Function : NONE
Directory :  /home/fdshops/public_html/Modules/Cms/Entities/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/fdshops/public_html/Modules/Cms/Entities/CmsPage.php
<?php

namespace Modules\Cms\Entities;

use Illuminate\Database\Eloquent\Model;

class CmsPage extends Model
{
    /**
     * The attributes that aren't mass assignable.
     *
     * @var array
     */
    protected $guarded = ['id'];

    /**
     * The accessors to append to the model's array form.
     *
     * @var array
     */
    protected $appends = ['slug', 'feature_image_url'];

    /**
     * Get the slug for post.
     *
     * @return string
     */
    public function getSlugAttribute()
    {
        return strtolower(str_replace(' ', '-', $this->title));
    }

    /**
     * Get the business that owns the user.
     */
    public function createdBy()
    {
        return $this->belongsTo(\App\User::class, 'created_by', 'id');
    }

    /**
     * Get the feature image.
     *
     * @return string
     */
    public function getFeatureImageUrlAttribute()
    {
        $image_url = null;

        if (! empty($this->feature_image)) {
            $image_url = asset('/uploads/cms/'.rawurlencode($this->feature_image));
        }

        return $image_url;
    }

    /**
     * Get the feature image path.
     *
     * @return string
     */
    public function getFeatureImagePathAttribute()
    {
        $image_path = null;

        if (! empty($this->feature_image)) {
            $image_path = public_path('uploads').'/cms/'.$this->feature_image;
        }

        return $image_path;
    }

    /**
     * Get the meta for the page.
     */
    public function pageMeta()
    {
        return $this->hasMany('Modules\Cms\Entities\CmsPageMeta', 'cms_page_id', 'id');
    }

    public static function getEnabledPages($type = 'page')
    {
        $pages = CmsPage::where('type', $type)
                    ->whereNull('layout')
                    ->orderBy('priority', 'asc')
                    ->where('is_enabled', 1)
                    ->get();

        return $pages;
    }

    public static function getPagesCount($type = '')
    {
        if (empty($type)) {
            return 0;
        }

        $pages_count = CmsPage::where('type', $type)
                        ->where('is_enabled', 1)
                        ->count();

        return $pages_count;
    }
}

Spamworldpro Mini