MIF_E31222378/app/Models/Photo.php

30 lines
635 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Photo extends Model
{
use HasFactory;
protected $fillable = ['user_id', 'customer_id', 'booking_id', 'file_path', 'token'];
public function user()
{
return $this->belongsTo(User::class, 'customer_id');
}
public function customer()
{
return $this->belongsTo(User::class, 'customer_id');
}
public function booking()
{
return $this->belongsTo(Booking::class, 'booking_id'); // Asumsi kolom booking_id di tabel photos
}
}