I want to fetch only one columns which has name image_url from relationship table. relationship on table is belongsTO. i am confused how to fetch only single column value with belongsTo relation.
below is my model.
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class PropertyImageGallery extends Model
{
use HasFactory;
protected $fillable = ['property_id', 'name', 'size','image_url'];
public function property()
{
return $this->belongsTo(Property::class);
}
}
please help me.