You can call a relationship whatever you wish, it just requires that you are more explicit whenever defining the relationship:
// Booking.php
// Calling the relationship 'user' infers a 'user_id' foreign key
public function user()
{
return $this->belongsTo(User::class);
}
// The same relationship could be called 'owner' if that makes more sense in the context of your domain, but you must be explicit about the foreign key
public function owner()
{
return $this->belongsTo(User::class, 'user_id');
}
// Because the relationship is called passengers, you must be explicit about the pivot table name and foreign keys
public function passengers()
{
return $this->belongsToMany(User::class, 'booking_user', 'booking_id', 'user_id');
}
You can call a relationship everywhere, after well declare your model booking.php
// Booking.php
// the relation 'user' refers to your 'user.php' model
public function user()
{
return $this->belongsTo('App\user');
}
// the relation passenger, reference user model first, table namein second and table foreign keys attribs for the last
public function passengers()
{
return $this->belongsToMany('App\user, 'booking_user', 'booking_id', 'user_id');
}