Welcome Guest, Not a member yet? Register   Sign In
How add autocomplete to $model in Resource Controller
#1
Question 
(This post was last modified: 02-14-2023, 08:29 PM by evilgazz.)

I created class

PHP Code:
class WebWalker extends ResourceController
{
    protected $modelName 'App\Models\WebWalkerModel';
    protected $format 'json';

    public function index() {
        return $this->respond($this->model->findAll());
    }


But phpstorm/vscode don't suggest $this->model->.....

if I add the $model property and add a description to it in PHPDoc, then the autocomplete starts working, Am I doing the right thing?

PHP Code:
class WebWalker extends ResourceController
{
    /**
    * @var WebWalkerModel
    */
    protected $model 'App\Models\WebWalkerModel';
    protected $modelName 'App\Models\WebWalkerModel';
    protected $format 'json';

    public function index() {
        return $this->respond($this->model->findAll());
    }

Reply
#2

Yes your doing it right. Until they add these features that's the way it has to be done.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB