Welcome Guest, Not a member yet? Register   Sign In
Namespace or function?
#3

I prefer to use the function in almost every case since I usually want the shared instance. I still tend to call it with the namespaced class name though to make my code easier to read, search, and analyze:

use App\Models\ModelName;

$object = model(ModelName::class)->first();
Reply


Messages In This Thread
Namespace or function? - by superior - 07-21-2021, 12:59 AM
RE: Namespace or function? - by paulbalandan - 07-21-2021, 03:49 AM
RE: Namespace or function? - by MGatner - 07-21-2021, 05:50 AM
RE: Namespace or function? - by superior - 07-21-2021, 06:02 AM



Theme © iAndrew 2016 - Forum software by © MyBB