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


Messages In This Thread
How add autocomplete to $model in Resource Controller - by evilgazz - 02-14-2023, 08:26 PM



Theme © iAndrew 2016 - Forum software by © MyBB