Welcome Guest, Not a member yet? Register   Sign In
How to load model and helper
#7

(This post was last modified: 07-22-2016, 12:15 PM by idealcastle.)

(07-18-2016, 11:56 AM)kilishan Wrote: Interestingly enough, the Models docs doesn't actually say how to load a model. Embarrassing. Smile But, a model is just a class, so you would get a new instance of it like you would any other class:

Code:
$model = new \App\Models\MyModel();

The helpers docs do explain.



How might one "Auto-Load" a model?

Or, as for namespaces, I assume I cant add my "use \namespace;" and then call the model statically like Laravel? such as "ModeName::find(123)", seems repetitive to have to instantiate the class with "new Model()" and then call methods.
Reply


Messages In This Thread
How to load model and helper - by HTLove - 07-18-2016, 06:55 AM
RE: How to load model and helper - by PaulD - 07-18-2016, 07:08 AM
RE: How to load model and helper - by HTLove - 07-18-2016, 07:27 AM
RE: How to load model and helper - by ciadmin - 07-18-2016, 08:00 AM
RE: How to load model and helper - by kilishan - 07-18-2016, 11:56 AM
RE: How to load model and helper - by idealcastle - 07-22-2016, 12:10 PM
RE: How to load model and helper - by HTLove - 07-18-2016, 06:25 PM
RE: How to load model and helper - by kilishan - 07-22-2016, 12:34 PM
RE: How to load model and helper - by idealcastle - 07-22-2016, 01:31 PM



Theme © iAndrew 2016 - Forum software by © MyBB