Welcome Guest, Not a member yet? Register   Sign In
Detecting Model->delete() query result - how to detect error?
#2

You can catch those exceptions in your controller by doing something like:



PHP Code:
try {
   if ($foo->delete($id)) {
      echo 'success';
   } else {
      echo 'ooops';
   }
} catch (\
Exception $e) {
   $yourException $e->getMessage();

Website: marcomonteiro.net  | Blog: blog.marcomonteiro.net | Twitter: @marcogmonteiro | TILThings: tilthings.com
Reply


Messages In This Thread
RE: Detecting Model->delete() query result - how to detect error? - by marcogmonteiro - 07-02-2020, 01:35 AM



Theme © iAndrew 2016 - Forum software by © MyBB