lundi 3 juillet 2017

Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails

I am using laravel 5.4 when i try to delete foriegn key it show me this error how i get resolve it.

In my controller

 public function destroy($id)
    {
        User::destroy($id);
        return  redirect('/admin/adminuser')
           ->with('delete', 'Admin Record deleted successfuly!');
    }

I wrote function like this this user id is foreign key for another table so when i try to delete this user from user side it send this error how to i resolve it ..

Please help me out to clear this issue



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire