Closed AhsanAbrar closed 3 years ago
How is the the relationship defined in your Location-model?
<?php
namespace App;
use Vinelab\NeoEloquent\Eloquent\Model;
class Location extends Model
{
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'Location';
/**
* The attributes that aren't mass assignable.
*
* @var array
*/
protected $guarded = [];
public function user()
{
return $this->belongsTo('App\User', 'LOCATED_AT');
}
}
I had a quick look by my guess is that I should be assigned as this:
$location = Location::find(1922); $user = User::find(3876); $relation = $location->user()->associate($user);
You'll need to save after you associate.
me too. solution:
$city = City::first();
$hotel->city()->save($city);
model hotel:
**
* Belong to city
*
* @return \Vinelab\NeoEloquent\Eloquent\Relations\HasOne
*/
public function city()
{
return $this->hasOne(City::class, 'BELONGS_TO');
}
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
when i use this for EdgeIn like mentioned in docs
got this error:
where is the problem?