I am trying to do the following:
$org = Organization::first();
$user = Auth::user();
$org->owner()->save($user);
return $org;
My returned values are:
{"_id":"55f333759a370912040041c8",
"name":"Beta Productions",
"updated_at":"2015-09-11 20:03:01",
"created_at":"2015-09-11 20:03:01"}
If I try to return $org->owner
, I don't get anything.
Here is my organization class:
<?php
namespace App;
use Jenssegers\Mongodb\Model as Model;
class Organization extends Model
{
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = ['name'];
public function owner()
{
return $this->embedsOne('App\User');
}
}
Any thoughts?