I want to add another condition to (L_Examen_Objectif::where('libelle', '=', $request->input('libelle') )->exists())
The condition If I get the same libelle has the same id it should return True
(I don't want to insert the same libelle with the same id.)
Here is it my code:
public function addPost(Request $request, $id)
{
if (L_Examen_Objectif::where('libelle', '=', $request->input('libelle') )->exists()) {
return 'true';
}
else {
$Examen_data = array(
'libelle' => $request->input('libelle'),
'id_examen' => $request->input('id_examen'),
'id_lexamen' => $id,
);
L_Examen_Objectif::insert($Examen_data);
}
}