Forms Laravel5与惰性负载之间的雄辩关系
我在我的模型中有关系:Forms Laravel5与惰性负载之间的雄辩关系,forms,laravel,eloquent,laravel-5,Forms,Laravel,Eloquent,Laravel 5,我在我的模型中有关系: public function profile() { return $this->hasOne('App\Models\Profile'); } 及表格: {!! Form::model($user, ['route' => ['profile.update'], 'method' => 'PATCH']) !!} ... <div class="form_block"><span class="form_label"&g
public function profile()
{
return $this->hasOne('App\Models\Profile');
}
及表格:
{!! Form::model($user, ['route' => ['profile.update'], 'method' => 'PATCH']) !!}
...
<div class="form_block"><span class="form_label">First Name</span>{!! Form::text('profile[first_name]') !!}</div>
...
那么,也许一些能言善辩的人可以选择控制关系上的延迟负载?
找不到有关它的任何信息。您正在查找Laravel调用的内容 我认为load()实际上不会返回任何内容。您可以这样访问配置文件:$user=Auth::user()$用户->加载('profile')$userWithProfile=$user->profile;
$user_id = Auth::user()->id;
$user = User::with('profile')->find($user_id);
$userWithProfile = Auth::user()->load('profile');