I want to know the possible errors or exception that elqouent save() may cause. In laravel, I do as shown below when saving or updating a model.
// create or update some data if($model->save()){ // continue return true; } throw new Exception('Model could not be saved');
I do not prefer the save() environment to the if to check if the model is saved. If this throws an exception, I would love to try..catch it in a try..catch block, for example,
try{ // create or update some data $model->save() // continue return true; catch(SomeException $e){ throw new Exception('Model could not be saved'); }
So, can laravel eloquent collection save() go wrong? Or am I just thinking about it?
source share