Support the ongoing development of Laravel.io →
Security Architecture
Last updated 1 year ago.
0

Laravel is namespaced, so you must use "\Exception":

try{
    // try code
} 
catch(\Exception $e){
    // catch code
}
Last updated 8 years ago.

zegarr liked this reply

1

youndivian said:

Laravel is namespaced, so you must use "\Exception":

try{
   // try code
} 
catch(\Exception $e){
   // catch code
}

Thanks buddy! this saved me a lot of time

0

youndivian said:

Laravel is namespaced, so you must use "\Exception":

try{
   // try code
} 
catch(\Exception $e){
   // catch code
}

Same here man, saved me a lot of time, thanks.

0

youndivian said:

Laravel is namespaced, so you must use "\Exception":

catch(\Exception $e){
   // catch code
}

tanks. its work. but for what?

(\Exception

and no

(Exception

:/

Last updated 6 years ago.
0

mortezaataiy said:

youndivian said:

Laravel is namespaced, so you must use "\Exception":

catch(\Exception $e){
   // catch code
}

tanks. its work. but for what?

(\Exception

and no

(Exception

:/

You have to import Exception class and there are two ways of using class on Laravel Controller,

1). Either on the top you can write Use Exception; 2). or you can directly use exception class by \Exception

Last updated 6 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

abelkbil abelkbil Joined 22 Feb 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.