// SYSTEM PANEL //
[ROOT]
/
mnt
/
pleskStorage
/
vhosts
/
kodsolutions.net
/
subdomains
/
go-rent.kodsolutions.net
/
app
/
Models
/
Car
[ PARENT ]
EDIT :: Category.php
<?php namespace App\Models\Car; use App\Helpers\Constants; use App\Models\Model; use Illuminate\Database\Eloquent\Factories\HasFactory; use Spatie\Translatable\HasTranslations; class Category extends Model { use HasFactory; use HasTranslations; public $translatable = ['title']; protected $fillable = [ 'title', 'position', 'active', 'image', 'icon', 'slug', 'type', // Car or Types(brand-model...) 'category_id', 'in_home' ]; // 'vehicle_type_id', // 'sedan', 'suv', 'hatchback', 'van', 'pickup', 'luxury', 'other' // 'brand_id', // brand // 'model_id', // brand // 'year_id', // year // 'category_id', // 'economy', 'standard', 'premium', 'luxury', 'suv', 'van' // 'fuel_type_id', // 'petrol', 'diesel', 'hybrid', 'electric' // 'transmission_id', // 'manual', 'automatic' // 'insurance_type_id', // 'comprehensive', 'third_party' // 'color_id', // 'comprehens public function scopeBrand($query) { return $query->where('type', Constants::CAT_BRAND); } public function scopeCarCategory($query) { return $query->where('type', Constants::CAR_CATEGORY); } public function scopeTransmission($query) { return $query->where('type', Constants::CAT_TRANSMISSION_TYPE); } public function scopeInsuranceType($query) { return $query->where('type', Constants::CAT_INSURANCE_TYPE); } public function scopeCarYear($query) { return $query->where('type', Constants::CAT_YEAR); } public function scopeVehicleType($query) { return $query->where('type', Constants::CAT_VEHICLE_TYPE); } public function scopeCarStatus($query) { return $query->where('type', Constants::CAT_STATUS_TYPE); } public function scopeCarModel($query) { return $query->where('type', Constants::CAT_MODEL); } // FuelType public function scopeFuelType($query) { return $query->where('type', Constants::CAT_FUEL_TYPE); } // /CarColor public function scopeCarColor($query) { return $query->where('type', Constants::CAT_COLOR_TYPE); } public function getIconPathAttribute() { $value = $this->icon; if ($value != '') { $value = asset($value); } else { $value = asset('default.png'); } return $value; } public function Brands() { return $this->belongsTo(Category::class, 'category_id'); } }
SAVE
CANCEL