![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/mcoil.corals.io/app/Shop/CategoryBoxes/ |
<?php namespace App\Shop\CategoryBoxes; use Illuminate\Database\Eloquent\Model; class CategoryBox extends Model { protected $fillable = [ 'title', 'sub_title', 'link', 'image', 'section', 'created_at', 'updated_at', 'meta_alt' ]; /*public function setLinkAttribute($value) { $scheme = parse_url($value, PHP_URL_SCHEME); $value = ($value == 'javascript:void(0);') ? null : $value; if (empty($scheme) && !empty($value)) { $value = 'http://'.ltrim($value, '/'); } if(!empty($value)){ $this->attributes['link'] = $value; } else { $this->attributes['link'] = null; } } public function getLinkAttribute() { if(!empty($this->attributes['link']) && $this->attributes['link'] != 'javascript:void(0);') { $this->attributes['link'] = preg_replace('/^(?!https?:\/\/)/', 'http://', $this->attributes['link']); } else { $this->attributes['link'] = 'javascript:void(0);'; } return $this->attributes['link']; }*/ public function getImageAttribute() { if(!empty($this->attributes['image'])) { return \Storage::url($this->attributes['image']); } else { if($this->attributes['section'] == 'short-term') { return 'images/shortterm/Short-Term-Vehicle-Hire-Cars.jpg'; } else { return 'images/longterm/Long-Term-Vehicle-Lease-Cars-Icon.jpg'; } } } }