I just came from Laravel development so I suppose there is a wordpress-ish way to go about accessing a model and maybe I am missing some step?
You don’t, Laravel is a framework that provides structure, and so models are models, but in WP there’s none of that.
Plugins in WordPress are just PHP files with a comment at the top with some meta data. They’re not contained, sandboxed, or separated in any way, which means:
- you can’t infer anything from the folder/file name a class might be in
- those objects and variables aren’t stored in a common place, unless that plugin puts it in one
- there is no standard way to grab a plugins data structures, if it has any data structures at all
A plugin may not have any models to fetch, it may use a different programming paradigm, it may not store any data at all. A plugin might even load parts of Laravel and use Laravel to structure itself internally. I’ve used Symfony components in WP plugins myself
So if the data is stored using WordPress APIs such as custom post types, post meta, taxonomies, etc, then you can use all the standard WP functions to retrieve them. You will need to do some investigation to understand what the post meta values LearnDash stores, and what they mean and do though.
As for controllers and models, WP provides no controllers and models. Any classes WP does provide are not places to store or extend. It isn’t an OO framework, or a framework at all, you have to provide those bits.
So how do you get that object with the data you want?
- Look at the learndash docs
- Read the code to figure out where that class is instantiated into an object and how it’s stored
- Look for singletons, static variables, global variables, filters
- Accept that there may not be a way to fetch it
But more importantly, contact LearnDash support. 3rd party plugins are offtopic, so any answer you get here will be generic, it won’t tell you the specifics of LearnDash. If LearnDash support can’t help, then that’s unfortunate, you’ll need to hire a developer who knows LearnDash, investigate alternatives, or read the LearnDash code and docs to figure it out