Skip to content

Commit

Permalink
create car model
Browse files Browse the repository at this point in the history
  • Loading branch information
stazrouti committed Sep 16, 2024
1 parent c94da36 commit 91a5f5b
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions rental-car-backend/app/Models/Car.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

namespace App\Models;

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

class Car extends Model
{
use HasFactory;
protected $fillable = [
'Name', 'Model', 'Year', 'Doors', 'AC', 'Transmission', 'Fuel', 'Price_per_day', 'Status'
];

// A car can have many images
public function images()
{
return $this->hasMany(CarImage::class, 'car_id'); // Assuming 'car_id' is the foreign key in CarImage table
}

}

0 comments on commit 91a5f5b

Please sign in to comment.