Server IP : 66.29.132.124 / Your IP : 3.145.78.203 Web Server : LiteSpeed System : Linux business141.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : wavevlvu ( 1524) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/wavevlvu/book24.ng/modules/Page/Models/ |
Upload File : |
<?php namespace Modules\Page\Models; use App\BaseModel; use Astrotomic\Translatable\Contracts\Translatable as TranslatableContract; use Astrotomic\Translatable\Translatable; use Illuminate\Support\Facades\DB; use Illuminate\Database\Eloquent\SoftDeletes; use Modules\Core\Models\SEO; class Page extends BaseModel { use SoftDeletes; protected $table = 'core_pages'; protected $fillable = [ 'title', 'content', 'status', 'short_desc', 'image_id', 'template_id', 'header_style', 'custom_logo' ]; protected $slugField = 'slug'; protected $slugFromField = 'title'; protected $cleanFields = [ 'content', ]; public $translatedAttributes = [ 'title', 'content', 'short_desc', ]; protected $seo_type = 'page'; protected $sitemap_type = 'page'; public function getDetailUrl($locale = false) { return route('page.detail',['slug'=>$this->slug]); } public static function getModelName() { return __("Page"); } public static function getAsMenuItem($id) { return parent::select('id', 'title as name')->find($id); } public static function searchForMenu($q = false) { $query = static::select('id', 'title as name'); if (strlen($q)) { $query->where('title', 'like', "%" . $q . "%"); } $a = $query->orderBy('id', 'desc')->limit(10)->get(); return $a; } public function getEditUrlAttribute() { return url(route('page.admin.edit',['id'=>$this->id])); } public function template() { return $this->hasOne("\\Modules\\Template\\Models\\Template", 'id', 'template_id'); } public function getProcessedContent() { $template = $this->template; if(!empty($template)){ $translation = $template->translateOrOrigin(app()->getLocale()); return $translation->getProcessedContent(); } } }