如何在laravel 5.2中插入不同的表id

时间:2016-08-23 19:20:51

标签: laravel-5.2

我必须要教室和地位。我想在状态表中插入课堂ID。我的控制器:

 $userStatus = new Status();
 $userStatus -> status_text = $text;
 $userStatus -> video_url = $request['video_url'];
 $userStatus -> type = 2;
 $userStatus -> users_id = Auth::user()->id;
 $userStatus -> save();
 Flash::success('Your status has been posted');
 return redirect(route('class'));

如果我想插入类ID应该做什么?

1 个答案:

答案 0 :(得分:0)

哪个类ID来自?

否则你可以添加这一行:

 $userStatus -> class_id = 2;