i want to tell the users where is the problem occurs so that they can delete the data, it's something like throwback and tell them what's actually cause the problem of deleting the data from the database. Can someone help me to figure out like how ?
My destroy function coding is as below :
public function destroy($id)
{
$status = 'success';
$statusMsg = 'Data Deleted';
try {
$category = Category::find($id);
$category->delete();
} catch (QueryException $e) {
$status = 'success';
$statusMsg = $e;
return back();
}
$category = Category::find($id);
$category->delete();
return redirect()->route('category.index')->with($status, $statusMsg);
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire