大家好,stackoverflow的极客们,多亏了你们,我已经进入了幼虫学习曲线的最后阶段。但是,每次用户尝试删除分配给用户的角色时,我都需要生成一条警告消息,比如“您不能删除分配给用户的角色”。相反,它会加载一个包含sql错误的页面。我该怎么做?以及如何避免已存储的密码再次被散列。例如:- $2y$10$p8JwI5P4yE2UFo2.vHP99.0dP2jU7ll/9w73IzUa9/yegKOSTHJWq总是在我每次编辑用户信息时被散列。感谢你们所有人,是你们让我很容易地通过及时的回答来学习laravel
代码
public function destroy(Request $request,$id)
{
// delete
// $role = Role::find($id);
//$role->delete();
$role = Role::find ($id);
if ($role->users() !=null) {
return redirect()->back()->withInput(['warning' => 'Not allowed']);
}
$role->delete();
// redirect
Session::flash('message', 'Record successfully deleted!');
Session::flash('alert-type', 'success');
return Redirect::to('role');
}https://stackoverflow.com/questions/41438482
复制相似问题