codeigniter-phpstorm icon indicating copy to clipboard operation
codeigniter-phpstorm copied to clipboard

can i add some model in it?

Open weituotian opened this issue 9 years ago • 6 comments

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

weituotian avatar Jul 04 '16 09:07 weituotian

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 avatar Jul 04 '16 12:07 natanfelles

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

natanfelles avatar Jul 04 '16 12:07 natanfelles

thanks!it work very well!!!

weituotian avatar Jul 04 '16 13:07 weituotian

Brilliant, thank you!

milsanore avatar Oct 15 '16 10:10 milsanore

Awesome!

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

rajbdilip avatar Jan 14 '18 10:01 rajbdilip

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.

spitfire64 avatar Apr 11 '18 14:04 spitfire64