Server IP : 66.29.132.124 / Your IP : 3.147.82.108 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/News/Models/ |
Upload File : |
<?php namespace Modules\News\Models; use App\BaseModel; use Illuminate\Database\Eloquent\SoftDeletes; use Modules\Core\Models\SEO; class Tag extends BaseModel { use SoftDeletes; protected $table = 'core_tags'; protected $fillable = [ 'name', 'content', 'slug' ]; protected $slugField = 'slug'; protected $slugFromField = 'name'; protected $seo_type = 'news_tags'; public static function getModelName() { return __("New Tag"); } public static function searchForMenu($q = false) { $query = static::select('id', 'name'); if ($q) { $query->where('name', 'like', "%" . $q . "%"); } $a = $query->limit(10)->get(); return $a; } public static function saveTagByName($tag_name) { $ids = []; if (!empty($tag_name)) { foreach ($tag_name as $name) { $find = parent::where('name', trim($name))->first(); if (empty($find)) { $tag = new self(); $tag->name = $name; $tag->save(); $ids[] = $tag->id; } else { $ids[] = $find->id; } } } return $ids; } public function getDetailUrl($locale = false) { return route('news.tag.index',['slug'=>$this->slug]); } }