Created
May 2, 2022 20:13
-
-
Save elishaukpong/5434f8fc40ec96c2f0140c6510ed68be to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//With exceptions | |
try { | |
$model->name = "Elisha"; | |
$model->save(); | |
} catch(ModelFailedToSaveException $e){ | |
//Handle the exception | |
echo "It failed to save" | |
} | |
//Without exceptions | |
$model->name = "Elisha"; | |
if( ! $model->save()){ | |
//Handle the exception | |
echo "It failed to save" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment