Answer the question
In order to leave comments, you need to log in
How to interrupt the execution of the code with an error?
Good afternoon!
There is a similar code (I use Laravel):
class Class1
{
public function startFunc1()
{
if (!$this->getFunc2()) {
return back()->withErrors(['Произошла ошибка!']);
};
$i++;
//Продолжается код функции
}
}
$cl1 = new Class1();
$responseFunc1 = $cl1->startFunc1();
$cl2 = new Class2();
$data = $cl2->getFromList($request->articul);
return view('fs.index', ['data' => $data]);
return back()->withErrors(['Произошла ошибка!']);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question