i am using laravel 5.0 develop version
class User extends Model implements UserContract, RemindableContract {
public function info()
{
return $this->hasOne('App\Info');
}
}
and
php artisan tinker
(new App\User)->fill(['id'=>2,'email'=>'xxxx@gmail.com'])->info()->get();
DB::getQueryLog();
result is
'select * from `infos` where `infos`.`user_id` is null'
but i expected
'select * from 'infos' where 'infos'.`user_id` = 2
what is solution?? my expection is fault ?? help me!
============================== i solved this problem.. guarded property cause this problem
guarded = ['id'];
when
guarded = [];
fillable = ['id'];
result is
'select * from 'infos' where 'infos'.`user_id` = 2
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community