<?php

namespace App\Models;

use App\Models\CarReport;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Auth;

class ObjectModel extends Model
{
    use HasFactory;

    protected $fillable = [
        'name',
    ];

    public function carREports(){
        return $this->hasMany(CarReport::class,'object_id','id');

    }

    public function is_user_object($id){
        return $this->hasOne(UserObject::class,'object_id','id')
        ->where('user_id', $id);
    }
}
