<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Cars extends Model
{
    use HasFactory;

    protected $guarded = [];
    protected $casts = ['features' => 'array', 'images' => 'array'];

    public function category()
    {
        return $this->belongsTo(Category::class);
    }

    public function make()
    {
        return $this->belongsTo(Make::class);
    }

    public function car_detail()
    {
        return $this->hasOne(CarDetails::class, 'car_id');
    }

    public function car_general()
    {
        return $this->hasOne(CarGeneral::class, 'car_id');
    }

    public function car_engine()
    {
        return $this->hasOne(CarEngine::class, 'car_id');
    }

    public function pending_payment()
    {
        return $this->hasOne(PendingPayments::class, 'car_id');
    }
}
