Get the App
SLTechnology News&Howtos  ›  Development  › 

How to solve the problem of laravel Code hints in PHP Development Framework

Shulou Source: shulou.com Published: 2022-05-31 23:40:49 09月30日 Update

This article mainly introduces "PHP development framework laravel code hint problem how to solve", in the daily operation, I believe that many people in the PHP development framework laravel code hint problem how to solve the problem have doubts, Xiaobian consulted all kinds of materials, sorted out a simple and useful method of operation, hope to answer the "PHP development framework laravel code hint problem how to solve" the doubt is helpful! Next, please follow the editor to study!

Public function getTable () {return $this- > table? Str::snake (Str::pluralStudly (class_basename ($this));} class_basename takes the class name corresponding to the instance, pluralStudly, converts the class name to plural snake, and converts the hump into an underlined format.

Here is the default according to the class name underlined plus plural recommendation not to change, but if you delete the plural can also get the table name

Public function getTable () {return $this- > table? Str::snake (class_basename ($this));} / / convert deleted to Boolean public $defaultCasts = ['deleted' = >' boolean']; public function _ construct (array $attributes = []) {parent::__construct ($attributes); parent::mergeCasts ($this- > defaultCasts);}

Will merge the data into the

Ide optimized code hint this is an ide hint extension package

Install this package

Composer require-dev barryvdh/laravel-ide-helper

Three ways to use

Yes generates class files directly. No is not generated and there are hints, but there will be some weird saving information.

If there is no prompt to delete the status of the comment information, there will be a prompt.

If there is a hint of tilde, just use query directly.

Help find the source code of the facade

You can prompt the message of the alias.

At this point, the study on "how to solve the problem of laravel code hints in PHP development framework" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Tags: Hint code problem framework development learning information plural class name more help generation practical weird next underscore no alias instance Boolean Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Linux Docker MariaDB Apple