Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can i add some model in it? #1

Open
weituotian opened this issue Jul 4, 2016 · 6 comments
Open

can i add some model in it? #1

weituotian opened this issue Jul 4, 2016 · 6 comments
Labels

Comments

@weituotian
Copy link

# can my model can be showed by adding my model property in the file?

@natanfelles
Copy link
Owner

natanfelles commented Jul 4, 2016

Yes. Just add something like:

/**
 * Class Profile
 * @property   General_model $general
 * @property   Profile_model $profile
 */
class Profile extends CI_Controller {

    public function __construct()
    {
        parent::__construct();
        $this->load->model('general_model', 'general');
        $this->load->model('profile_model', 'profile');
    }

    public function index()
    {
        // Settings from General_model
        $data['settings'] = $this->general->get_settings();
        ...
    }

@natanfelles
Copy link
Owner

This file too works in Netbeans if do you want. :)

@weituotian
Copy link
Author

thanks!it work very well!!!

@milsanore
Copy link

Brilliant, thank you!

@rajbdilip
Copy link

rajbdilip commented Jan 14, 2018

Awesome!

@natanfelles I think you should include this in README.md.

@spitfire64
Copy link

spitfire64 commented Apr 11, 2018

And if you extend a Model (like User_Model) from another model, like MY_Model, you just write something like:

/**
 * Class User
 * @property   User_model $user_model
 * @property   MY_Model $MY_model
 */

Now PHP Storm can assist you with your functions from MY_Model when you write code in the User controller.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants