Home > other >  How to use error in Laravel 7 in program?
How to use error in Laravel 7 in program?

Time:10-25

Error Image In Laravel

I want use that error in my code, ex.

if(Not Found In Database) then
show alert"Data Not Found In Database"

How to make that error include to my variabel?

*Note: I'm using Laravel-7

CodePudding user response:

first check you have record or not
$data = model::all();
if($data == NULL){
  echo "<script>alert('data not found')</script>"

}

CodePudding user response:

You can try

throw new \Exception("error");
  • Related