jeudi 7 mai 2020

Laravel: What happens when a method calls a another function that has a try/catch?

In my controller, I have a function checkItemName():

controller

use App\Models\AdjustColor;

public function checkItemName()
{
    $all = request()->user();
    AdjustColor::log($item, request('pay'), request('order'));
    return response()->json(['status' => 1]);
}

AdjustColor.php

function log() {
  try {
     ///
  } catch () {
     ///
  }
}

Within it, I call log(), which is part of my AdjustColor model. In log(), I have a try/catch. If the catch is triggered there, what happens here in the checkItemName()? Do I need another try/catch in here?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire