Laravel怎么在Model定义复合主键
展开全部
1.
find --> 返回 object or empty
ex:
$p = Project::find($id);
if(empty($p)) {
dd('project is empty');
}
get --> 返回object , 透过count 方法判断
ex:
$p = Project::where('user_id', '=', $userid)->get();
if($p->count() == 0) {
dd('project is empty');
}
find --> 返回 object or empty
ex:
$p = Project::find($id);
if(empty($p)) {
dd('project is empty');
}
get --> 返回object , 透过count 方法判断
ex:
$p = Project::where('user_id', '=', $userid)->get();
if($p->count() == 0) {
dd('project is empty');
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询